fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <cmath>
  4. int main() {
  5.  
  6. int numHours;
  7. int totHours;
  8. int actualHours;
  9. int studyMore;
  10.  
  11. // Putting out statement for how many hours.
  12. cout << "How many credit hours are you taking?" << endl;
  13.  
  14. // Waiting for input/multiplying hours taken by three to get total hrs
  15. cin >> numHours;
  16. totHours = numHours * 3;
  17. cout << numHours << "hrs." << endl << endl;
  18.  
  19. // The next lines are displaying how many hours you should be studying.
  20. cout << "You should be spending " << totHours << "hrs";
  21. cout << " outside of class studying.";
  22. cout << endl << endl;
  23.  
  24. // Q2) Below asking the actual time spent studying/getting input from user.
  25. cout << "How many hours do you actually spend studying?" << endl;
  26. cin >> actualHours;
  27. cout << actualHours << "hrs." << endl << endl;
  28.  
  29. studyMore = totHours - actualHours;
  30.  
  31. // This will tell you, that you have or have not been efficient in studying.
  32.  
  33. if(studyMore < 0)
  34. {
  35. cout << "You have studied a good amount of hours!";
  36. }
  37. else if(studyMore >= 0)
  38. {
  39. cout << "You should study more, you dont want to fail!" << endl << endl;
  40. }
  41.  
  42.  
  43. return 0;
  44. }
  45.  
  46. // This is code #2
  47.  
  48. int stadFeet;
  49. int circumferenceBall;
  50. int numPlayers;
  51.  
  52. stadFeet =
  53. cout << "The Rio de Janeiro Stadium is 105 by 68 meters this calculates to";
  54.  
  55.  
  56.  
Success #stdin #stdout 0s 4500KB
stdin
15
46
stdout
How many credit hours are you taking?
15hrs.

You should be spending 45hrs outside of class studying.

How many hours do you actually spend studying?
46hrs

You have studied a good amount of hours!