已知书桌的材质,品牌,功能不同,价格也不同。请采用结构描述书桌信息,并输出2款书桌的信息供购买者参考。下面代码正确的是( )
A.
#include #define NUM 50 struct desk { char texure[NUM]; char brand[NUM]; char function[NUM]; float price; } int main() { struct desk desk1={"wood","Top Cop.","up and down",1880 }; struct desk desk2={"composite","ordinary","80*100",600}; printf("compare two desks:\n"); printf("1: texture: %s %s\n",desk1.texure,desk2.texture); printf("2:brand: %s %s\n",desk1.brand,desk2.brand); printf("3:function:%s %s\n",desk1.function,desk2.function); printf("4:price: %.2f,%.2f\n",desk1.price,desk2.price); return 0; }
B.
#include #define NUM 50 struct desk { char texure[NUM]; char brand[NUM]; char function[NUM]; float price; } int main() { struct desk desk1,desk2; printf("compare two desks:\n"); printf("1: texture: %s %s\n",desk1.texure,desk2.texture); printf("2:brand: %s %s\n",desk1.brand,desk2.brand); printf("3:function:%s %s\n",desk1.function,desk2.function); printf("4:price: %.2f,%.2f\n",desk1.price,desk2.price); return 0; }
C.
#include #define NUM 50 struct desk { char texture[NUM]; char brand[NUM]; char function[NUM]; float price; }; int main() { struct desk desk1={"wood","Top Cop.","up and down",1880 }; struct desk desk2={"composite","ordinary","80*100",600}; printf("compare two desks:\n"); printf("1: texture: %s %s\n",desk1.texture,desk2.texture); printf("2:brand: %s %s\n",desk1.brand,desk2.brand); printf("3:function:%s %s\n",desk1.function,desk2.function); printf("4:price: %.2f,%.2f\n",desk1.price,desk2.price); return 0; }