简单的结构体成员赋值

来源:互联网 发布:广告优化师面试技巧 编辑:程序博客网 时间:2024/06/05 04:59
#include "stdafx.h"#include "iostream"#include "windows.h"#include "string"#include "cstring"using namespace std;struct ch{char name[21];int num;string party;};int main(int argc, char* argv[]){ch ch1={"wang",18,"zhan"};ch ch2;ch2=ch1;cout<<ch1.name<<ch1.num<<ch1.party<<endl;cout<<ch2.name<<ch2.num<<ch2.party<<endl;system("pause");return 0;}

原创粉丝点击