结构体小试

来源:互联网 发布:小米3抢购软件 编辑:程序博客网 时间:2024/06/04 19:24
/** Copyright (c)2013, 烟台大学计算机学院学生* All rightsreserved.* 文件名称: array.cpp* 作    者:   李中意* 完成日期:2014  年 3 月 5  日* 版本号: v1.0* 输入描述:无*/#include <iostream>using namespace std;struct Date{    int month;    int day;    int year;};struct Student{    int num;    char name[20];    char sex;    Date birthday;    float score;}student1,student2={10001,"wang ling",'f',5,20,1994,90.8};int main(){    student1=student2;    cout<<"学号:"<<student1.num<<endl;    cout<<"名字:"<<student1.name<<endl;    cout<<"性别:"<<student1.sex<<endl;    cout<<"生日:"<<student1.birthday.month<<'/'<<student1.birthday.day<<'/'<<student1.birthday.year<<endl;    cout<<"成绩:"<<student1.score<<endl;    return 0;}


 

0 0
原创粉丝点击