當前位置:編程學習大全網 - 編程軟體 - 誰幫我看看這段關於結構體的C語言代碼

誰幫我看看這段關於結構體的C語言代碼

程序更改如下:

#include<stdio.h>

#include<string.h>

struct date

{

int year;

int month;

int day;

};

struct infor

{

char name[6];

char sex[4];

float high;

float weight;

struct date timeofenter;

int photonumber;

};

typedef struct infor in;

main(void)

{

in qx;

in *p=&qx;

strcpy(qx.name,"hjx");

strcpy(qx.sex,"man");

qx.high=166;

qx.weight=66;

qx.timeofenter.year=2007;

qx.timeofenter.month=9;

qx.timeofenter.day=1;

printf("%s",p->name);

printf("%s",p->sex);

printf("%d",p->high);

printf("%d",p->weight);

printf("%d",p->timeofenter.year);

printf("%d",p->timeofenter.month);

printf("%d",p->timeofenter.day);

}

主要問題:給name和sex賦值要用strcpy,給month賦值不能用09,因為0開頭編譯器默認是8進制數,看看還有什麽問題嗎

  • 上一篇:關於填充顏色的數學問題
  • 下一篇:linux下python和webpy怎麽搭建
  • copyright 2024編程學習大全網