fork download
  1. #include<iostream.h>
  2.  
  3. #include<stdio.h>
  4.  
  5. class student
  6.  
  7. {
  8.  
  9. char Name[25];
  10.  
  11. int rno,total_marks, marks[5];
  12.  
  13. char grade, d;
  14.  
  15. float avg;
  16.  
  17.  
  18.  
  19. char calgrade()
  20.  
  21. {
  22.  
  23. for(int i=0;i<5;i++)
  24.  
  25. {
  26.  
  27. total_marks+=marks[i];
  28.  
  29. avg=total_marks/5;
  30.  
  31. if(avg>=80&& avg<=100)
  32.  
  33. grade='A';
  34.  
  35. if(avg>=60)
  36.  
  37. grade='B';
  38.  
  39. if(avg>=40)
  40.  
  41. grade='C';
  42.  
  43. else
  44.  
  45. grade='D';
  46.  
  47. }
  48.  
  49. return grade;
  50.  
  51. }
  52.  
  53. public: void input()
  54.  
  55. {
  56.  
  57. cout<<"\n Enter student name";
  58.  
  59. gets(Name);
  60.  
  61. cout<<"\n Enter rollno";
  62.  
  63. cin>>rno;
  64.  
  65. cout<<"\n Enter marks";
  66.  
  67. for(int i=0;i<5;i++)
  68.  
  69. cin>>marks[i];
  70.  
  71. d=calgrade();
  72.  
  73. }
  74.  
  75. void display()
  76.  
  77. {
  78.  
  79. cout<<"\n Name:"<<Name;
  80.  
  81. cout<<"\n Rollno:"<<rno;
  82.  
  83. cout<<"\n Marks of 5 subjects :";
  84.  
  85. for(int i=0;i<5;i++)
  86.  
  87. cout<<marks[i]<<" ";
  88.  
  89. cout<<"\n Average mark "<<avg;
  90.  
  91. cout<<"\n The grade is :"<<d;
  92.  
  93. }
  94.  
  95. }B[10];
  96.  
  97. void main()
  98.  
  99. {
  100.  
  101. int n;
  102.  
  103. cout<<"\n Enter number of students";
  104.  
  105. cin>>n;
  106.  
  107. for(int i=0;i<n;i++)
  108.  
  109. B[i].input();
  110.  
  111. for(i=0;i<n;i++)
  112.  
  113. B[i].display();
  114.  
  115. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: fatal error: iostream.h: No such file or directory
compilation terminated.
stdout
Standard output is empty