Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string sub,tf;
  8. int m1,m2,m3,m4,sum,TEZA;
  9. double avg;
  10.  
  11. cout<<"SIMPLE AVERAGE CALCULATOR";
  12. cout<<"\n"<<"\n"<<"Subject at hand?: ";
  13. cin >> sub;
  14. cout <<"\n"<< "Input the FOUR marks you'd like verified: "<<"\n";
  15. cout<<"\n"<<"M1: ";cin >> m1;
  16. cout<<"\n"<<"M2: ";cin >> m2;
  17. cout<<"\n"<<"M3: ";cin >> m3;
  18. cout<<"\n"<<"M4: ";cin >> m4;
  19. cout<<"\n"<<"Would you like to include the TEZA grade?(Y/N): ";
  20. cin>>tf;
  21.  
  22. sum=m1+m2+m3+m4;
  23. avg=(double)sum/4;
  24.  
  25. if (tf=="Y"){
  26. cout<<"What is the TEZA grade?: ";
  27. cin>>TEZA;
  28. cout<<"\n"<<"Your average grade at "<<sub<<" is "<<((double)avg*3+TEZA)/4<<"\n"<<"\n";}
  29.  
  30. else
  31. cout<<"\n"<<"Average at "<<sub<<" is "<<avg<<"\n"<<"\n";
  32.  
  33. cout<<"DO YOU PASS?: "<<"\n";
  34.  
  35. if (avg>=5)
  36. cout<<"Yes."<<"\n";
  37. else
  38. cout<<"No."<<"\n";
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement