0

Im stuck here can any one help my project asap 😖😖😢

/*write a program to print the number of day, amount taken for the day, and the amount remaining at the end of the day. The output should terminated when 30 days have been printed or the amount remaining is less than 100 litters, whichever come first. For example, if W is 1000 and P is 10, The output should start as follows; Day Amount Taken Amount Remaining 1 100 900 2 90 810 3 81 729 please help me to fix my project :'( */ #include <iostream> #include <iomanip> using namespace std; int main() { int liter = 1000; int amountTaken = 100; int amountRemaining = liter - amountTaken ; int = 5 int Day[i]; cout << "Please enter the number of liter : "; cin >> liter; cout << "\n"; cout << fixed; cout << setprecision (2); cout << left << setw(15) << "Day"; for(int i = 0; i > 5; i++) cout << "Please enter the number of Day :"; cin >> i; cout << right << setw(15) << "Amount Taken"; cout << right << setw(15) << "Amount Remaining"; cout << left << setw(15) << Day; cout << right << setw(15) << amountTaken; cout << right << setw(15) << amountRemaining; cout << "\n"; return 0; }

8th Dec 2018, 5:07 PM
Notorious.mimi
Notorious.mimi - avatar
4 Réponses
+ 5
To be able to test codes and make permanent changes, it is recommended that you save your code in the code playground under the C++ tab. I have taken the liberty to do so, you can now copy it to your profile, and test it here itself. https://code.sololearn.com/cf3LiOYov2G1/?ref=app I have marked the errors in the code for your reference. Let me know if you have any further problem.
8th Dec 2018, 5:30 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 4
How can you expect this mess work?! (Just kidding) - There are numerous variables undeclared. - The program's logic is vague. Add some info if you can to give us a kick to progress!
8th Dec 2018, 5:29 PM
Babak
Babak - avatar
+ 3
Very interesting! First is first. Let's formatting the spaghetti! #include <iostream> #include <iomanip> using namespace std; int main() { int liter = 1000; int amountTaken = 100; int amountRemaining = liter - amountTaken ; int Day; cout << "Please enter the number of liter : "; cin >> liter; cout << "\n"; cout << fixed; cout << setprecision (2); cout << left << setw(15) << "Day/s"; cout << right << setw(15) << "Amount Taken"; cout << right << setw(15) << "Amount Remaining"; cout << left << setw(15) << Day; cout << right << setw(15) << amountTaken; cout << right << setw(15) << amountRemaining; cout << "\n"; return 0; }
8th Dec 2018, 5:25 PM
Babak
Babak - avatar
0
/*write a program to print the number of day, amount taken for the day, and the amount remaining at the end of the day. The output should terminated when 30 days have been printed or the amount remaining is less than 100 litters, whichever come first. For example, if W is 1000 and P is 10, The output should start as follows; Day Amount Taken Amount Remaining 1 100 900 2 90 810 3 81 729 please help me to fix my project :'( */ #include <iostream> #include <iomanip> using namespace std; int main() { int liter = 1000; int amountTaken = 100; int amountRemaining = liter - amountTaken ; int = 5 int Day[i]; cout << "Please enter the number of liter : "; cin >> liter; cout << "\n"; cout << fixed; cout << setprecision (2); cout << left << setw(15) << "Day"; for(int i = 0; i > 5; i++) cout << "Please enter the number of Day :"; cin >> i; cout << right << setw(15) << "Amount Taken"; cout << right << setw(15) << "Amount Remaining"; cout << left << setw(15) << Day; cout << right << setw(15) << amountTaken; cout << right << setw(15) << amountRemaining; cout << "\n"; return 0; }
13th Dec 2018, 3:14 AM
Notorious.mimi
Notorious.mimi - avatar