Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void challenge_1(){ //Candy Robots
- long double performance;
- long double endurance;
- long double cost;
- long double budget;
- long double candy_p = 0;
- long double time = 0;
- long double amt;
- cout << "how many candies can a robot produce per hour ?" << endl;
- cin >> performance;
- cout << "how long(hours) can the robot produce this amount of candy per hour before only producing 1 candy per hour" << endl;
- cin >> endurance;
- cout << "what is the cost of one robot (per hour) ?" << endl;
- cin >> cost;
- cout << "what is your budget (how much money are you willing to spend) ?" << endl;
- cin >> budget;
- while(budget >= cost){
- while(endurance > 0){
- candy_p = candy_p + performance;
- time++;
- endurance--;
- budget = budget - cost;
- }
- if(endurance == 0){
- candy_p++;
- time++;
- budget = budget - cost;
- }
- }
- if(budget < cost){
- cout << "\none robot~" << endl;
- cout << "candies produced: " << candy_p << endl;
- cout << "the amount of hours you were able to produce candy for: " << time << endl;
- cout << "your remaining budget is $" << budget << endl;
- int choice;
- cout << "would you like to calculate the budget needed for multiple robots ? 1=yes 2=no" << endl;
- cin >> choice;
- if (choice == 1){
- cout << "\nhow many robots would you like to test this with (using the same imput from before) ? " << endl;
- cin >> amt;
- cout << "the cost of those robots would be $" << (time * cost) * amt << endl;
- }
- else{
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement