Monday, May 24, 2010

Its a c++ program, plz helpppp?

#include %26lt;conio.h%26gt;// needed for getch


#include %26lt;iostream.h%26gt;//needed for cout message


#include %26lt;math.h%26gt;// need got math


#include %26lt;iomanip.h%26gt;//


#include %26lt;string.h%26gt;// needes for strings


void startup();


void method(double sqrt(double num));


int main()


{


startup();


method(double sqrt(double num));


getch();


return 0;


}


void startup()


{


cout%26lt;%26lt;""%26lt;%26lt;'\n';


cout%26lt;%26lt;"Jan 24, 2008"%26lt;%26lt;'\n';


cout%26lt;%26lt;"pg162 problem 9.1.2"%26lt;%26lt;'\n';


cout%26lt;%26lt;""%26lt;%26lt;'\n';


}


void method(double sqrt(double num))


{


int num;


cout%26lt;%26lt;"Enter a number to be squared rooted: ";


cin%26gt;%26gt;num;


cout%26lt;%26lt;num;


}








i'm trying to find the sqrt of the number the user is going to enter but my book just says that the function is sqrt. plz help. thx

Its a c++ program, plz helpppp?
http://www.cplusplus.com/reference/clibr...





In function method fuggetyerparameter. declare int num as double num and replace the line "cout%26lt;%26lt;num;" with "cout%26lt;%26lt;sqrt(num);"





Programs that use conio.h tend to be c, not c++ because it is a c library. For getch(); you might try "system("pause");". System is in the stdlib.h header, which I believe is #included in a couple of the headers you are using.





Now can I go back to sleep?


No comments:

Post a Comment