help ASAP!!

hello i am having trouble with some code that i have typed up i just cant seem to get it working. any help would be gratefully appreciated
the errors that i get are that when the code is compiled when i input a number for seconds the if else if does not seen to kick in when i enter a number greater than 3600
I don't know if its the whole if statement itself or if its just a piece of it

I'm still new to c++ (only been working with the code for a week now)

int main()
{
double seconds, minutes, hours, days;

cout << "Enter a number of seconds:";
cin >> seconds;


if (3600 >= seconds && seconds >= 60){
minutes = seconds / 60;
cout << "This is the amount of minutes in these seconds:\n";
cout << minutes << "\n";
}
else if (seconds >= 86400 && seconds >= 3600){
hours = seconds / 3600;
cout << "This is the amount of hours in these seconds:\n";
cout << hours << "\n";
}
else if (seconds >= 86400){
days = seconds / 86400;
cout << "This is the amount of days in these seconds:\n";
cout << days << "\n";
}
system ("pause");
return 0;
}
Last edited on
i am very sorry for anyone who can not understand what i am getting at in this post

i have been having a very bad and frustrating day
I'm not even to class inheritence and constructors+destructors in my C++ programming, so I may be misinformed, but I'd take a look at your 2nd 'if else' statement.

else if (seconds >= 86400 && seconds >= 3600){

problem is here^
what you probably ment was

else if (seconds <= 86400 && seconds >= 3600){

simple semantic error. Took me about half a minute of staring at your code to figure it out. Tell me if this works.
Does this seem right to you?? Read it carefully...

(seconds >= 86400 && seconds >= 3600)
thanks for the help it was that specific else if statement i dont understand why i missed it oh well
thank you anyway
Topic archived. No new replies allowed.