Sunday, August 2, 2009

I have a doubt regarding c++ program?

frenz...i'm a beginner in c++ programming...i wrote a sample program which goes as..


// sample program


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


main()


{


cout%26lt;%26lt;"welcome to c++ programming";


}





i compiled dis program n' it says


FATAL.....\INCLUDE\IOSTREM.H22:unable to create output file 'C:\TC\OUTPUT\NONAME.01.obj'





wht does this mean...n' hw can i rectify dis mistake?

I have a doubt regarding c++ program?
you have to 1st create a main with a variable, which can be:


void, int, bool, double, float





so to cut out some work, I use void main()





you left out:





after the '#include...' line 'using namespace std;'


you left out a return variable for main (to cut out the work I would put 'void main()')
Reply:read links...below hope this will help





S.T.
Reply:#include%26lt;iostream%26gt;





using namespace std;





int main()


{


cout%26lt;%26lt;"welcome to c++ programming";


return 0;


}





Write this code . I think this will solve the problem. And always write the code the way shown.





1. Don't use .h after any C++ header file


2. Always write the line "using namespace std;" after all "#include%26lt;...%26gt;" statements are complete.


3. int before main()


4. return 0 before "}"
Reply:edit your code to look like this:





#include %26lt;iostream%26gt;





using std::cout





int main()


{


cout %26lt;%26lt; "welcome to c++ programming";


return 0;


}


No comments:

Post a Comment