Can anyone give me some advice
I need to make the source code for Create a C++ console application that converts a time entered in minutes into either a hour/ minute format or into seconds.
It must contain a structure a decision statement and enumeration and constants for the conversion factors. Hers’s what I have so far but I cannot figure out the rest.
As favor929 said, enumerations aren't really needed but if you say it must have one, then it is extected you use the enum constants at a later time. So you may declare usersChoice as the enum type.
Hmm...advice...
- Don't put an ; after the if statements*
- Are you sure that the user will get 00:00 if exit is chosen? If not, you have to put that before the if statement of choice 3.
- It seems that setw() and setfill() aren't necessary here, the default width will be fine enough to print what you have. What if the user enters a very large number for min so that min/60 is three digits? setw(2) truncates the output.
- Avoid using system()
*
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// This
if (usersChoice == 1);
DoSomething();
// means
if (usersChoice == 1)
{
;
}
DoSomething();
// but what you want is
if (usersChoice == 1)
{
DoSomething();
}
// or
if (usersChoice == 1)
DoSomething();