fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int rows = 2, columns = 3 ;
  8. double scores[rows][columns] ;
  9. for (int i = 0 ; i < rows ; i++){
  10. cout << "Enter the grades of student " << i + 1 << '\n';
  11. for (int j = 0; j < columns; j++){
  12. do{
  13. cout << "Subject " << j+1 << ": "<< '\n' ;
  14. cin >> scores[i][j] ;
  15. } while(scores[i][j]< 0 || scores[i][j] > 100);
  16. }
  17. cout << "=============================\n";
  18. }
  19. for (int i = 0 ; i < rows ; i++){
  20. double sm = 0 ;
  21. for (int j = 0; j < columns; j++){
  22. sm += scores[i][j] ;
  23. }
  24. double perc = sm / 300 * 100 ;
  25. cout << "The Score of student " << i + 1 << ':';
  26. cout << perc << "%\t" ;
  27. if (perc >= 85) cout << "Excellent";
  28. else if (perc >= 75) cout << "V.Good";
  29. else if (perc >= 65) cout << "Good";
  30. else if (perc >= 50) cout << "Fair";
  31. else cout << "Poor";
  32. cout << '\n';
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Enter the grades of student 1
Subject 1: 
Subject 2: 
Subject 3: 
=============================
Enter the grades of student 2
Subject 1: 
Subject 2: 
Subject 3: 
=============================
The Score of student 1:2.31766e-310%	Poor
The Score of student 2:3.71037e-311%	Poor