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; }