#include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
struct Student
{
int No;
char *Name;
char Sex;
float Score;
};
int i;
struct Student Stu[3] =
{
{10,"LiPing",'M',800.5},
{11,"Wang Pan",'F',400.5}, // 性别注意是字符要用 ' ' 扩住初始化
{12,"Archer",'M',1000.5} //注意最后一个结构体变量初始后不要加","号
};
for(i=0;i<3;i++)
{
printf("No = %d ,Name = %s,Sex = %c,Score = %6.1f \n",
Stu[i].No , Stu[i].Name , Stu[i].Sex , Stu[i].Score);
}
system("PAUSE");
return EXIT_SUCCESS;
}