fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. struct student
  5. {
  6. char name[100];
  7. int age;
  8. char major[100];
  9. float score1;
  10. float score2;
  11. float score3;
  12. float score4;
  13. float score5;
  14. float grade1;
  15. float grade2;
  16. float grade3;
  17. float grade4;
  18. float grade5;
  19.  
  20. } Jess;
  21.  
  22. int main(void) {
  23. strcpy( Jess.name, "Jessica");
  24. Jess.age = 22;
  25. strcpy( Jess.major, "Computer Science");
  26. Jess.score1 = 100;
  27. Jess.score2 = 86;
  28. Jess.score3 = 92;
  29. Jess.score4 = 100;
  30. Jess.score5 = 94;
  31. Jess.grade1 = 'A';
  32. Jess.grade2 = 'B';
  33. Jess.grade3 = 'A-';
  34. Jess.grade4 = 'A';
  35. Jess.grade5 = 'A-';
  36.  
  37. printf( "Name : %s\n", Jess.name);
  38. printf( "Age : %d\n", Jess.age);
  39. printf( "Major : %s\n", Jess.major);
  40. printf( "The score on test 1 : %f\n", Jess.score1);
  41. printf( "%s 's score on test 2 : %f\n", Jess.name, Jess.score2);
  42. printf( "The score on test 3 : %f\n", Jess.score3);
  43. printf( "The score on test 4 : %f\n", Jess.score4);
  44. printf( "The score on test 5 : %f\n", Jess.score5);
  45. printf( "The grade on test 1 : %f\n", Jess.score1);
  46.  
  47. return 0;
  48. }
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
Name : Jessica
Age : 22
Major : Computer Science
The score on test 1 : 100.000000
Jessica 's score on test 2 : 86.000000
The score on test 3 : 92.000000
The score on test 4 : 100.000000
The score on test 5 : 94.000000
The grade on test 1 : 100.000000