+ 2

Need help on hovercraft test c++

For some reason every time i try and run the code i get no output why? https://sololearn.com/coach/42/?ref=app

29th Apr 2022, 5:03 PM
Eric Risher
Eric Risher - avatar
4 Answers
+ 8
balance needs to be equal to loss for Broke Even to print. Also, output variables should be same as given in task. "Profit", "Loss"...
30th Apr 2022, 8:28 AM
Simba
Simba - avatar
+ 2
Show your try so that we can help.
29th Apr 2022, 5:20 PM
Adil
Adil - avatar
+ 2
#include <iostream> using namespace std; int main() { int hovercraftSold, balance; int cost = 20000000; //cost to make 10 hovercrafts int rent = 1000000; //cost of rent a month int loss = cost + rent; //total loss for a month cin >> hovercraftSold; //takes input of how many hovercrafts sold balance = hovercraftSold * 3000000; //calculates profit made if(balance > loss){ cout << "proft" << endl; } if(balance < loss){ cout << "loss" << endl; } if(balance == 0){ cout << "Broke even" << endl; } return 0; }
29th Apr 2022, 5:22 PM
Eric Risher
Eric Risher - avatar
0
#include <iostream> using namespace std; int main() { int hovercraftSold, balance; int cost = 20000000; //cost to make 10 hovercrafts int rent = 1000000; //cost of rent a month int loss = cost + rent; //total loss for a month cin >> hovercraftSold; //takes input of how many hovercrafts sold balance = hovercraftSold * 3000000; //calculates profit made if(balance > loss){ cout << "Profit" << endl; } if(balance < loss){ cout << "Loss" << endl; } if(balance == loss){ cout << "Broke Even" << endl; } return 0; }
24th Nov 2022, 11:30 PM
Andrei Cristian šŸ‡·šŸ‡“
Andrei Cristian šŸ‡·šŸ‡“ - avatar