|
![]() | 作者: hahaflying [hahaflying]
![]() |
登录 |
本帖由 [日月双星] 从 << 菜鸟乐园>> 转移而来#include <iostream.h> #include <stdio.h> struct PERSON { int age; char sex; float weight; char name[25]; }; void main() { struct PERSON one; struct PERSON *p; p = &one; p->age = 32; p->sex = 'M'; p->weight = 80.2; one.name = "Ding you he"; cout<<"姓名:"<<one.name<<endl; cout<<"性别:"<<(*p).sex<<endl; cout<<"年龄:"<<(*p).age<<endl; cout<<"体重:"<<(*p).weight<<endl; getchar(); } |
地主 发表时间: 04-08-25 22:53 |
![]() | 回复: 286 [unique] ![]() |
登录 |
#include <iostream.h> #include <stdio.h> #include <string.h> //-------------------------- struct PERSON { int age; char sex; float weight; char name[25]; }; void main() { struct PERSON one; struct PERSON *p; p = &one; p->age = 32; p->sex = 'M'; p->weight = (float)80.2;//-------------------------------- strcpy(one.name, "Ding you he");//------------------------- cout<<"姓名:"<<one.name<<endl; cout<<"性别:"<<(*p).sex<<endl; cout<<"年龄:"<<(*p).age<<endl; cout<<"体重:"<<(*p).weight<<endl; getchar(); } |
B1层 发表时间: 04-08-26 08:48 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号