//============================================================================
// Name : 结构体引用1.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
typedef struct student
{
int num;
string name;
float score[3];
}student;
void printf(student &);
int main()
{
student stu = {12345, "li li", 67.5, 89, 78.5};
printf(stu);
return 0;
}
void printf(student &stu)
{
cout<<stu.num<<endl;
cout<<stu.name<<endl;
cout<<stu.score[0]<<endl;
cout<<stu.score[1]<<endl;
cout<<stu.score[2]<<endl;
return;
}
c++:结构体类型作为函数参数
最新推荐文章于 2024-06-12 17:21:09 发布