Tuesday, July 14, 2009

C++ help ?

I am having problem using printf function in C++, i am new to C so what changes shud i make in the below program ?





/*Ramesh Basic Salary*/


main ()


{


float DA,HRA;


float GS;





DA = 0.2;


HRA = 0.4;





/*Ramesh's Gross salary is sum total of DA and HRA*/;





GS = 10000*.2+.4;





printf("%f" , GS);


}

C++ help ?
You need to include the stdio.h header in the source code in order to use the printf() function declared in it. At the start of your program add the following.





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





/*Ramesh Basic Salary*/


main ()


{


float DA,HRA;


float GS;





DA = 0.2;


HRA = 0.4;





/*Ramesh's Gross salary is sum total of DA and HRA*/;





GS = 10000*.2+.4;





printf("%f" , GS);


}
Reply:#include %26lt;stdio.h%26gt;





/*Ramesh Basic Salary*/


main ()


{


float DA,HRA;


float GS;





DA = 0.2;


HRA = 0.4;





/*Ramesh's Gross salary is sum total of DA and HRA*/;





GS = 10000*.2+.10000*4+10000;





printf("%f" , GS);


}





as WITH in my knowledge Gross salary = Net salary + DA+HRA;


GS = 10000 +10000*.2+10000*.4
Reply:#include %26lt;stdio.h%26gt;


void main ()


{


float DA,HRA;


float GS;





DA = 0.2;


HRA = 0.4;





/*Ramesh's Gross salary is sum total of DA and HRA*/;





GS = 10000*.2+.4;





printf("%f\n" , GS);


}
Reply:Do you HAVE to use the printf function in C++, or are you using it because you don't know about COUT?

easter cards

No comments:

Post a Comment