Originally Posted by
grjae
This is the way my teacher has been teaching us for my C programming class. I only have been in the class for two weeks so I am still very new with how to put it in the right structure. This is the code i got now.
HOLY CRAP! Your teacher is teaching this hodgepodge as C language?
You need to sit down with the Dean or Principal and start the conversaition with: "Excuse me sir, but I don't think my C programming teacher knows what he's doing..."
Code:
#include "StdAfx.h" << --- not a C header
#include <iostream> << --- Not a C header
int main(); <<--- should be int main (void)
int Number1, Number2, Number3; << --- old style pre C-89 variable declarations
{
cout<< "Please enter number1"; <<--- cout is NOT a C function
cin>> Number1; <<--- cin is NOT a C function
cout<< "Please enter number2";
cin>> Number2;
cout<< "Please enter number3";
cin>> Number3;
if (Number1 == Number2 && Number2 == Number3) <<-- well, this much is right.
cout<< the numbers ARE the same; << --- not a C function, should be quoted in C++
} <<-- mismatched braces
else
{ <<-- more mismatched braces
cout<< the numbers ARE NOT the same; <<-- not a C function, should be quoted in C++
return 0;
}
Now take this to your teacher's boss... and get yourself a proper teacher!