I don't think an assignment is going to get any more basic than this.
Review your book on how if statements work. I can't really give you any examples without giving away the entire solution.
EDIT:
I suppose I can give you an example if statement:
1 2 3 4 5 6 7 8 9
int main()
{
int myvar = 5;
if( myvar == 5 )
{
// this code will only run if myvar is equal to 5
}
}
The "condition" for the if statement goes in those parenthesis. For your condition, you would need to check two variables and see if one is less than the other.
#include <iostream.h>
That's incorrect. On any C++ compiler made in the last 15 years, it should be #include <iostream>
void main()
That has never been correct C++. Any decent C++ compiler should reject it (Microsoft persists in accepting it, for some reason, without even giving a warning).
If you're using a C++ compiler from the last 15 years, you will also need a usingnamespace std;
in there.
TURBO C++ is not C++. It is an old thing that people used to call C++, ten years ago.
The programming language it understands is not C++. It looks a lot like C++, but it isn't C++. Your code will NOT work on a modern, correct C++ compiler.
Here is an attempt to compile your code on a modern, correct C++ compiler. As you can see, it does not compile: http://ideone.com/7H7s1
TURBO C++ displays the results without any objection...
y???
Because it's old. Pre-standard old. Before the standard came out, c++ compilers all did things their own way, which was bad because code that was written for one compiler would not work if you tried to run it on another compiler.
The standard gives clear rules for how all compilers should work. Therefore if you write code that is standards compliant, it will work on all compilers.
Also, don't give out full homework solutions. Georgette isn't going to learn anything by someone just doing her homework for her. You just got used.
Georgette isn't going to learn anything by someone just doing her homework for her.
Although if Georgette does hand that in, she won't get much in the way of marks :)
Edit: Unless she's in the same class as macs. Is this why we keep seeing this sort of thing year after year? Somewhere there's a perpetual programming class being taught where the "correct" answers are twenty years behind everywhere else?
Seriously, this is fantastically simple. If you can't do this, we're kind of stuck about how to help you without just giving you the answer. Do you know how to make a completely empty C++ program? Just an empty main, and get it to compile? We could start there, I suppose.
This does not seem easy to me im a communication major and got told to sign up for this. I can't even drop the class i need it to graduate. No I don't can you please try to help me understand