Guest User

Untitled

a guest
Jan 27th, 2020
187
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. author: Reem Said
  3. Department Mechatrones
  4.  
  5. */
  6. #include <iostream>
  7. using namespace std;
  8.  
  9.  
  10. int main () {
  11.  
  12. double mark1, mark2, mark3, totalSubject1,totalSubject2, avaregeSubject1,avaregeSubject2;
  13. string subject1, subject2;
  14.  
  15. //input
  16.  
  17. cout << "Enter subject1: ";
  18. cin >> subject1;
  19.  
  20. cout << "Enter subject2: ";
  21. cin >> subject2;
  22.  
  23. cout << "\n-------------------------------";
  24. cout << " \n";
  25.  
  26. cout << "enter mark for ";
  27. cout << subject1;
  28.  
  29. cout << " \n";
  30. cout << "Enter mark1: ";
  31. cin >>mark1;
  32. cout << "Enter mark2: ";
  33. cin >>mark2;
  34. cout << "Enter mark3: ";
  35. cin >>mark3;
  36. cout << "\n-------------------------------";
  37. cout << " \n";
  38.  
  39. cout << "enter mark for ";
  40. cout << subject2;
  41.  
  42. cout << " \n";
  43. cout << "Enter mark1: ";
  44. cin >>mark1;
  45. cout << "Enter mark2: ";
  46. cin >>mark2;
  47. cout << "Enter mark3: ";
  48. cin >>mark3;
  49. cout << "\n-------------------------------\n";
  50.  
  51.  
  52. //process
  53.  
  54. totalSubject1 = mark1 + mark2 + mark3;
  55. avaregeSubject1= totalSubject1/3;
  56.  
  57. totalSubject2 = mark1 + mark2 + mark3;
  58. avaregeSubject2= totalSubject2/3;
  59.  
  60.  
  61.  
  62. //output
  63.  
  64.  
  65. // subject1
  66. cout << subject1;
  67. cout << "\t total :";
  68. cout << totalSubject1;
  69. cout << "\t avareg :";
  70. cout << avaregeSubject1;
  71.  
  72. cout << avaregeSubject1;
  73. cout << "\t ";
  74.  
  75. if (avaregeSubject1 >= 55){
  76. cout << "**** PASS ****\n";
  77. }
  78. else {
  79. cout << "**** FAIL ****\n";
  80. }
  81.  
  82.  
  83.  
  84. //subject2
  85. cout << subject2;
  86. cout << "\t total :";
  87. cout << totalSubject2;
  88. cout << "\t avareg :";
  89.  
  90. cout << avaregeSubject2;
  91.  
  92. cout << avaregeSubject2;
  93. cout << "\t ";
  94.  
  95. if (avaregeSubject2 >= 55){
  96. cout << "**** PASS ****\n";
  97. }
  98. else {
  99. cout << "**** FAIL ****\n";
  100.  
  101.  
  102.  
  103. }
  104.  
  105. }
RAW Paste Data