vs2010编译C++ 结构体

//结构体的测试
// CTest.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; struct person{ char name[15]; char sex; int age; }m[3]={{"FangMin",'F',24},{"LiLin",'M',23},{"WuBin",'M',23}}; int _tmain(int argc, _TCHAR* argv[]) { person *p = m; cout<<"姓名 "<<"\t"<<"性别"<<"\t"<<"年龄"<<endl; for(;p<m+3;p++){ cout<<p->name<<"\t"<<p->sex<<"\t"<<p->age<<endl; } cout<<"hello world"<<endl; system("pause"); return 0; }

 

posted @ 2015-05-23 09:37  bksqmy  阅读(428)  评论(0编辑  收藏  举报