Can any inform me on how to write 4 different while or do-while loops counting down to 0, it has to be lined up column by column.
Example:
Expand|Select|Wrap|Line Numbers
- Days hours Minutes
- ------- --------- ------------
- 0 96 382
- 1 72 .
- 2 48 .
- 3 24
. .
something like that......... I don't know how to keep the while statements on the same row. I'm kind of new to this.
Oh and here's the width and the while pgm i'm having problems with.
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- //Declaring variables.
- int can, mis;
- double misleft;
- //Prompting users input for num. of cannibals.
- cout<<"Please enter a number equal or greater than 10"<<'\n'<<"for the amount of cannibals!"<<" ";
- cin>>can;
- cout<<endl;
- //Prompt user input for num. of missionaries.
- cout<<"Please enter a number equal or greater than 5"<<'\n'<<"for the amount of missionaries to be saved!"<<" ";
- cin>>mis;
- cout<<endl;
- cout<<" "<<"ThankYou!"<<endl;
- cout<<endl;
- cout<<endl; //Spacing out lines
- //Calculated pgm cout formation to display End of hr, miss. left, cann. eating, tarz. dist., and curr. miss lft.
- //Setting width within statement.
- cout<<"END OF HOUR"<<setw(10)<<"MISSIONARIES LEFT"<<setw(10)<<"CANNIBALS EATING"<<setw(10)<<"TARZAN DISTANCE"<<setw(10)<<"CURR MISS BEING EATEN"<<endl;
- cout<<"------------"<<setw(10)<<"-----------------"<<setw(10)<<"----------------"<<setw(10)<<"---------------"<<setw(10)<<"--------------------"<<endl;
- cout<<endl;
- //for statement to calc. hours.
- for (int hours = 0; hours < 31; hours++)
- cout<<hours<<'\n';
- return 0;
- }