fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int numCreditHours;
  6. int numStudyHours;
  7. int numHoursStudying;
  8. int diffBetweenHoursStudying;
  9.  
  10. cout << "How many credit hours are you currently taking?" << endl;
  11. cin >> numCreditHours;
  12. numStudyHours = numCreditHours * 3;
  13. cout << "How many hours do you spend studying outside of class per week?" << endl;
  14. cin >> numHoursStudying;
  15. diffBetweenHoursStudying = numStudyHours - numHoursStudying;
  16. cout << "You should be spending " << numStudyHours << " hours studying outside of class each week." << endl;
  17. cout << "You are studying " << diffBetweenHoursStudying << " hours less than you should.";
  18. return 0;
  19. }
Success #stdin #stdout 0s 4284KB
stdin
13 26
stdout
How many credit hours are you currently taking?
How many hours do you spend studying outside of class per week?
You should be spending 39 hours studying outside of class each week.
You are studying 13 hours less than you should.