Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1.  
  2.  
  3.  
  4. 1.
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. struct st
  10. {
  11. string sname;
  12. string sid;
  13. float cgpa;
  14. int marks[3]={};
  15.  
  16. };
  17.  
  18. void set_student(struct st student[],int size )
  19. {
  20.  
  21. student[0].sname="Ahmed Jalal";
  22. student[0].sid="123";
  23. student[0].cgpa=3.65;
  24. student[0].marks[0]=10;
  25. student[0].marks[1]=19;
  26. student[0].marks[2]=20;
  27.  
  28. student[1].sname="Ahmed kamal";
  29. student[1].sid="124";
  30. student[1].cgpa=3.95;
  31. student[1].marks[0]=20;
  32. student[1].marks[1]=19;
  33. student[1].marks[2]=20;
  34. }
  35. void disp(struct st student[],int size)
  36. {
  37. int i,j;
  38. for(i=0;i<size;i++)
  39. {
  40. cout<<"Student info:"<<i+1<<endl;
  41. cout<<"NAME:"<<student[i].sname<<endl;
  42. cout<<"ID:"<<student[i].sid<<endl;
  43. cout<<"CGPA:"<<student[i].cgpa<<endl;
  44. cout<<"MARKS OF 3Quizzes:"<<endl;
  45. for(j=0;j<3;j++)
  46. {
  47. cout<<student[i].marks[j]<<endl;
  48. }
  49.  
  50. }
  51.  
  52. }
  53.  
  54. int main()
  55. {
  56. st student[2];
  57. set_student(student,2);
  58. disp(student,2);
  59. }
  60.  
  61. 3.#include <iostream>
  62.  
  63. using namespace std;
  64.  
  65. struct st
  66. {
  67. string sname;
  68. string sid;
  69. float cgpa;
  70. int marks[3]={};
  71.  
  72.  
  73. };
  74.  
  75. void set_student(struct st student[],int size )
  76. {
  77.  
  78. student[0].sname="Ahmed Jalal";
  79. student[0].sid="123";
  80. student[0].cgpa=3.65;
  81. student[0].marks[0]=10;
  82. student[0].marks[1]=19;
  83. student[0].marks[2]=20;
  84.  
  85. student[1].sname="Ahmed kamal";
  86. student[1].sid="126";
  87. student[1].cgpa=3.95;
  88. student[1].marks[0]=20;
  89. student[1].marks[1]=19;
  90. student[1].marks[2]=20;
  91.  
  92.  
  93. int best quiz[20]={};
  94. float average marks[16.33]={};
  95.  
  96. };
  97.  
  98. void best quiz(struct st student[],int size)
  99.  
  100. {
  101. student[0].best quiz=20;
  102.  
  103. };
  104. void average marks(struct st student[],int size)
  105. {
  106. student[2].average marks=16.33;
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement