วันพุธที่ 1 กรกฎาคม พ.ศ. 2552

การบ้านโครงสร้างข้อมูล

#include
#include
main(){
struct profile
{
char name [40];
int age; char sex[10];
char address[30];
char work[10];
int weight;
int high;
char future[20];
}profile_1;
strcpy(profile_1.name,"Nathasa");
profile_1.age = 22;strcpy(profile_1.sex,"female");
strcpy(profile_1.address,"123/32 Bangkok");
strcpy(profile_1.work,"Office");
profile_1.weight = 52;profile_1.high = 165;
strcpy(profile_1.future,"Work");
printf("Name %s\n",profile_1.name);
printf("Age %d\n",profile_1.age);
printf("Sex %s\n",profile_1.sex);
printf("Address %s\n",profile_1.address);
printf("Work %s\n",profile_1.work);
printf("Weight %d\n",profile_1.weight);
printf("High %d\n",profile_1.high);
printf("Futur %s\n",profile_1.future);
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น