Advertisement
hamaXD

Final 58 ตอนที่ 2 ข้อ1

Dec 8th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. struct article{
  4.     char title[60];
  5.     char cat[50];
  6.     int num;
  7.     float price;
  8. };
  9. struct article art = {"Yumyum","Food",20,14.5};//Mama
  10. struct article art2;
  11. struct article art3[5] = { {"Mama","",0,0} ,
  12. {"","",0,0},{"","",0,0},
  13. {"","",0,0},{"","",3,0}};
  14. struct article output(struct article art[]);
  15.  
  16. int main(){
  17.     printf("enter title (art2):");
  18.     scanf("%s",art2.title);
  19.     printf("enter num (art2):");
  20.     scanf("%d",&art2.num);
  21.     printf("%s %s %d %.1f\n",art2.title,art2.cat,art2.num,art2.price);
  22.     int i=0;
  23.     while(i<5){
  24.             printf("[%d] : %s %s %d %.1f\n",i+1,art3[i].title,art3[i].cat,art3[i].num,art3[i].price);
  25.         i++;
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement