I can compile it with GCC on Linux if I remove #include<conio.h>, it must be some kind of windows only header. And is not even standard for windows compilers. I recommend not including it.
#include <iostream>
usingnamespace std;
int main()
{
cout<<"I am so so so changed "<<endl;
return 0;
}
In your code, you have specified using int main() function that your code will only end when you type any int(or integer) number at end with "return" function. So to end your program, you just have to add return 0; at end of your code.
In your code, you have specified using int main() function that your code will only end when you type any int(or integer) number at end with "return" function. So to end your program, you just have to add return 0; at end of your code.
If the end of main is reached, it as if the user returned 0. One needn't explicitly return 0 from main, although this is not true of other functions which return values. main is a special case.
I would guess the OP gets a more explicit error message than he is supplying.
lol...engr...i guess this is ur 3rd post asking the same question....
ur problem is with ur compiler settings(32bit,64bit)...whatever others are saying about return etc is perfectly correct also but i hope that if u perform this correction still this problem will exist..
stay blessed
@engr
Your school gave you a great disservice in teaching C++ with some non-standard compiler. They should have though GCC because that compiler is cross platform, or at least the Microsoft Visual Studio C++ Compiler. Which uses all standard C++ functions and adds some only windows once.
Also all C++ programs must have an int main( ) or int main( int argc, char** argv ). And even if you had a void function, the point of a void function is that it does not return anything.
test.cpp:3:11: error: ‘::main’ must return ‘int’
test.cpp: In function ‘int main()’:
test.cpp:5:9: error: expected primary-expression before ‘void’
test.cpp:5:9: error: expected ‘;’ before ‘void’
test.cpp:5:9: error: declaration does not declare anything [-fpermissive]
GCC is the GNU Compiler Collection (originally the GNU C Compiler), a multi-platform collection of frontends for compilation, and happens to be pretty much the most popular C and C++ compiler around. Using Windows XP, you would use MinGW (Minimalist GNU for Windows), which is a port of GCC to the windows operating system. I would definitely recommend you use it, probably the easiest way to get started is to download an IDE that comes with it (look up Code::Blocks).
ohhhhhhhhh @NT3 which one should I download? minGW or Code::Blocks? O am using Orwel DEV C++ now.. it is new for me.. before that i used Turbo C++ and Turbo C for C programming
You could probably use Orwell DevC++ (from what I've seen, its not as bad as the original), though you could get Code::Blocks instead (I prefer it, but that might just be me, I had a few problems with Orwell DevC++ crashing at inopportune moments). Anyway, Orwell DevC++ actually comes with a form of MinGW (The TDM-GCC build), which is perfectly sufficient for your needs. It also has the added bonus of by default linking statically, which means that you don't need to provide DLL's for your programs. But yes, definitely DO NOT use Turbo C++.
I am using Orwel Dev C++..but the syntaxes are very strange to me.. like std::cout ..I skipped usingnamespace std; in Turbo. else it shows wrong. but here it should be included or std::cout is used.. which is new to me
- that's the unfortunate consequence of starting out with the obsolete Turbo C++. Sadly, it's used in some educational courses, which means as you've discovered, the need to un-learn certain things when eventually encountering standard C++.