QUOTE(crapp0 @ Jan 28 2006, 07:02 PM)
I'm starting c++ programming and i've used two compilers which were mentioned in this forum called Microsoft Visual C++ 2005 Express Edition(free) and BloodShed DEV IDE(free) and i can't even compile a simple c++ code such as:
#include<iostream.h>
void main(){
cout<<"Hello";
}
My college computer are using an old version of microsoft visual c++ but i dont know what version they are using and the new microsoft visual c++ 2005 express doesn't even seem to have a button to compile and run the program above which i've saved as a cpp file.
It would have been better if you could at least give us the compiler error message. Nonetheless, my best bet is the spacing between the #include and the <iostream.h>
Also note that some ANSI compliant C++ compilers nowadays do not accept deprecated header files. Some still do, but with warnings. You could use namespaces instead. If you want to include all functions in the namespace, do this:
CODE
#include <iostream>
using namespace std;
Secondly, we do not normally use void main in C++. I don't know why but some compilers just refuse to compile unless I use int main. So, a corrected version of your code as below should compile just fine. Note that the code has not been tested but it should compile fine:
CODE
#include <iostream>
using namespace std;
int main(){
cout << "Hello";
return 0;
}
Don't blame compilers nowadays. No doubt it's a hassle to beginners but it promotes a standard which eventually will promote good programming ethics within programmers. It's good to go through the hassle from the beginning so that you won't find it a hassle later in your programming career. Just my two cents.
This post has been edited by astalavista_baby: Feb 5 2006, 02:18 PM