![]() |
#2
lintaoyn2010-08-04 18:44
|
#include <iostream>
#include <string>
using namespace std;//头文件
//以下为结构体
struct student
{
int num;
string name;
float score[3];
}stu;
int main()
{
student stu={1234,"lili",78.5,34,445};
int a;
void print(student &);
print(stu);
cin>>a;
return 0;
}
void print(student &stud)
{
cout<<stud.num<<" "<<stud.name<<" "<<stud.score[0]<<" "<<stud.score[1]<<" "<<stud.score[2]<<endl;
}
在VC中提示student stu={1234,"lili",78.5,34,445};
不对。