struct的复制

来源:互联网 发布:淘宝上开网店要收费吗 编辑:程序博客网 时间:2024/05/01 06:32

* 程序的版权和版本声明部分
* Copyright (c)2012, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称: object.cpp
* 作者:王海涛
* 完成日期: 2013年*月** 日
* 版本号: v1.0
* 输入描述:无
* 问题描述:设计struct的复制。
* 程序输出:struct的复制
*/

#include <iostream>

using namespace std;
struct date
{
int month;
int day;
int year;
};
struct student
{
long num;
char name[20];
char sex;
date birthday;
int age;
float score;
char addr[20];
}stu1,stu2={01,"josh",'M',11,06,1993,20,93,"Beijing"};


int main()
{
stu1=stu2;
cout<<stu1.num<<'\n';
cout<<stu1.name<<'\n';
cout<<stu1.sex<<'\n';
cout<<stu1.birthday.month<<"/"<<stu1.birthday.day<<"/"<<stu1.birthday.year<<'\n';
cout<<stu1.age<<'\n';
cout<<stu1.score<<'\n';
cout<<stu1.addr<<'\n';
return 0;


}