fork download
  1. //Andrew Hord
  2. // section 2
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() { //the main function
  7. int numCredits; //initializes how many credit hours I'm taking
  8. int numHours; // initializes how many hours I should study
  9. cin >> numCredits; // input for credit hours
  10. numHours = (3*numCredits); // equasion for studying hours
  11. cout <<"You need to study " << numHours << " hours a week." <<endl; //output for credit hours
  12.  
  13.  
  14. int studyTime; //how much time i actualy study
  15. int Lazynessscore; // diffrence between the time I need to study and how much I do.
  16. cin >> studyTime; // input for how much I study
  17. Lazynessscore = numHours - studyTime; // equation for study time
  18. cout << "You need to study " << Lazynessscore << " more hours." <<endl; //output for Lazynessscore
  19.  
  20. double WidthMeters; //width of stadium in meters
  21. double LengthMeters; // length of stadium in meters
  22. double Widthfeet; //width of stadium in feet
  23. double Lengthfeet; //lenght of stadium in feet
  24. double size5Ball = 22.0; // size 5 ball in cm
  25. double ballcircumfrance; // circumfrance of a ball in centimeters
  26. int PlayersOnTeam; // how many people on each team
  27. double GameTime; // lenth of the game
  28. double TimePerPlayer; // time each player plays
  29. cin >> WidthMeters; // input for width
  30. cin >> LengthMeters; // input for length
  31. cin >> PlayersOnTeam; //input for the players
  32. cin >> GameTime; //input for game length
  33.  
  34. Widthfeet = WidthMeters * 3.28084; // width equasion
  35. cout << Widthfeet << " Fredom units wide." <<endl; //outputs width in feet
  36. Lengthfeet = LengthMeters * 3.28084; // lenght equasion
  37. cout <<Lengthfeet << " Freedom units long." <<endl; //outputs length in feet
  38.  
  39. ballcircumfrance = (size5Ball/2) * 3.14; //circumfrance
  40. cout << "Circumfrance is " << ballcircumfrance << " cm." <<endl; //outputs circumfrance
  41.  
  42. TimePerPlayer = GameTime / PlayersOnTeam; // calculation for Time per player on the feild
  43. cout <<"Assuming everyone plays the same ammount of time, each player plays " << TimePerPlayer << " minutes." <<endl; //outputs time per player
  44.  
  45.  
  46.  
  47.  
  48. return 0;
  49.  
  50. }
  51.  
Success #stdin #stdout 0s 4412KB
stdin
16 40 105 68 23 90
stdout
You need to study 48 hours a week.
You need to study 8 more hours.
344.488 Fredom units wide.
223.097 Freedom units long.
Circumfrance is 34.54 cm.
Assuming everyone plays the same ammount of time, each player plays 3.91304 minutes.