fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5. struct student {
  6. string name;
  7. int age;
  8. float prelim, midterm, endterm;
  9. };
  10. float compute_grade(float*prelim, float*midterm, float*endterm)
  11. {
  12. float solve =0.00;
  13. string remarks;
  14. solve = (*prelim*0.30) + (*midterm+0.30) + (*endterm*0.40);
  15. if (solve >= 75.00) {
  16. remarks = "PASSED";
  17. }
  18. else {
  19. remarks = "FAILED";
  20. }
  21. cout << fixed;
  22. cout << setprecision (2);
  23. cout << "\n\n\tThe student grade is" << solve << setw(15) << "Remarks: " << setw(3) << remarks << ".";
  24. return(solve);
  25. }
  26. int main() {
  27. student user;
  28. float*mypointer;
  29. system("COLOR F0");
  30. cout << "\n";
  31. cout << "\t\tSIMPLE GRADE DOLVER 1.0";
  32. cout << "\n\n";
  33. cout << "\tEnter The Name of the student: ";
  34. getline (cin, user.name);
  35. cout << "\n";
  36. cout << "\tEnter The age of the Student: ";
  37. cin >> user.age;
  38. cout << "\n";
  39. cout << "\t Enter the prelim grade";
  40. cin>>user.prelim;
  41. mypointer = &user.prelim;
  42. cout << "\n";
  43. cout << "\tEnter the midterm grade: ";
  44. cin >> user.midterm;mypointer = &user.midterm;
  45. cout << "\n";
  46. cout << "\tEnter endterm grade: ";
  47. cin >>user.endterm;
  48. mypointer =&user.endterm;
  49. cout << "\n\n";
  50. cout << "\t ==== GENERATED REPORT ====";
  51. cout << "\n\n";
  52. cout << "\n\tstudent name: " << user.name;
  53. cout << "\n\tstudent age: " << user.age;
  54. compute_grade (&user.prelim, &user.midterm, &user.endterm);
  55. cout << "\n\n";
  56. system("pause");
  57. }
Success #stdin #stdout #stderr 0.01s 5228KB
stdin
 
stdout
		SIMPLE GRADE DOLVER 1.0

	Enter The Name of the student: 
	Enter The age of the Student: 
	 Enter the prelim grade
	Enter the midterm grade: 
	Enter endterm grade: 

	 ==== GENERATED REPORT ====


	student name:  
	student age: 1184774944

	The student grade is0.30      Remarks: FAILED.

stderr
sh: 1: COLOR: not found
sh: 1: pause: not found