the first day C++中结构体的使用

来源:互联网 发布:网页代码编写软件 编辑:程序博客网 时间:2024/05/19 21:00

#include "stdafx.h"
#include <cstdlib>
#include<iostream>

using namespace std ;

struct Structure1{
 char   c;
 int    i = 9;
 float  f;
 double d;
};


int _tmain(int argc, _TCHAR* argv[])
{
 Structure1 s;
 Structure1 *a=&s;
 (*a).i = 5;
 s.c = 'a';
 cout << s.c << endl;
 cout << (*a).i << endl;
 cout << a->i << endl;

 system("pause");
 return 0;
}

以上如有 疑问可以留言以便讨论


0 0