Saturday, May 22, 2010

I need help in c++ very urgently.is there anywhere i can get it from?what is the best c++ compiler for beginer

can someone tell me whats wrong in this program.i get all my programs wrong...this is a very basic example





#include %26lt;iostream.h%26gt;


void main()


{


cout%26lt;%26lt;"Name: phatguy/n";


cout%26lt;%26lt;"grade - 2"


}

I need help in c++ very urgently.is there anywhere i can get it from?what is the best c++ compiler for beginer
Best compiler for Beginners : Turbo C/C++ Compiler





If you are sharp minded : Dev C++ would be better for beginning since it will give you good platform to shift onto linux C/C++ Standards.








The above prog is right except that "/n" is wrong its "\n"








but even your version shuld run fine just a little mistake in the output........ i think you hhave not set up you include directories correctly that is programs are not running..........
Reply:Ur program is having an error at line no: 4 and 5.


correct the line no 4 and 5 to:


cout%26lt;%26lt;"name: phatguy \n";


cout%26lt;%26lt;"grade -2";








Error description:


On line no 4 u have used /n in which the front slash is not allowed instead we have to use back slash i.e \n.





On line no 5 there is a statement terminator missing i.e


semicolan missing.





Then ur prg will be error free and u will able to compile the code.


but then also u will not able to see the out put.





For seeing the output what u can do is :








#include %26lt;conio.h%26gt; //header file for clrscr() , getch()


#include %26lt;iostream.h%26gt;


void main(void)


{


clrscr(); //function which will clear the screen.


cout%26lt;%26lt;"name: phatguy \n";


cout%26lt;%26lt;"grade -2";


getch();


}


No comments:

Post a Comment