0

is it good?😴😭

A farming field can be plowed by 6 tractors in 4 days. When 6 tractors work together, each of them plows 120 hectares a day. If two of the tractors were moved to another field, then the remaining 4 tractors could plow the same field in 5 days. How many hectares a day would one tractor plow then? I try this 🤦🏻‍♀️ #include <iostream> using namespace std; int main() { int TRACTOR=6; int WORKDAY=4; int plowEachDay=120; int Hectares =TRACTOR*WORKDAY*plowEachDay; int daily; int Trac; int Days; cout<<"\n\tHOW MUCH CAN A TRACTOR PLOW EACH DAY"; cout<<"\n\n\tTractor you used: "; cin>>Trac; cout<<"\n\n\tDays Finished : "; cin>>Days; daily = Hectares/Days/Trac; cout<<"\n\n\tTractor can Plow per day: "; cout<<daily; cout<<endl; cout<<endl; cout<<endl; return 0; }

12th Sep 2021, 10:26 AM
Jeeeedaaa
3 Answers
+ 2
Since Trac and Days have a direct value, it's not necessary to declare them as input variables. int Trac = 4; int Days = 5;
12th Sep 2021, 12:10 PM
Simba
Simba - avatar
+ 2
It looks good! I don't understand what is the problem.
12th Sep 2021, 10:36 AM
mesarthim
mesarthim - avatar
+ 2
Works fine, only problems I can guess: 1) Are you separating the input into two lines? Entering; 4 5 Produces the expected output of 144. 2) If you are expecting your input to show, you would need to cout it after taking the input. Like so: cin>>Trac; cout<<Trac; You can even work it backwards to test, entering: 6 4 Produces 120, as the question example shows. Also you don’t have to use endl like that, you can chain: cout << endl << endl; etc You had used \n also, better to stick with one way to insert line endings (makes it easier to understand for others). Continuity goes a long way.
12th Sep 2021, 11:12 AM
DavX
DavX - avatar