Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

write a c++ prgm to find the cube of given number

OpenStudy (anonymous):

#include<iostream.h> #include<conio.h> void main() { clrscr(); //to clear screen float cube(float); //function prototype float a,cu; cout<<"Enter any number:"; cin>>a; cu=cube(a); //function calling cout<<"\nCube of "<<a<<" is "<<cu; getch(); } float cube(float a) { float cu; cu=a*a*a; return(cu); } sry i donno c++ so jus copied the code -.-

OpenStudy (anonymous):

oh...i want this in simple language

mathslover (mathslover):

@A.Avinash_Goutham Please provide the link also .. -_-

OpenStudy (anonymous):

not by using float

OpenStudy (anonymous):

-.- printf("enter the number:"); scanf("%f",&x); x=x*x*x; printf("the cube of number %f",x);

OpenStudy (anonymous):

replace %f with %d nd float with int

OpenStudy (nick67):

#include <iostream> using namespace std; int main() { int value, cube; cin >> value; cube = value*value*value; cout << cube; return 0; }

OpenStudy (anonymous):

help me to do this in simple manner

OpenStudy (anonymous):

@nick67 can u write by giving the values

OpenStudy (nick67):

what do you mean ?

OpenStudy (anonymous):

cube = value*value*value; give some value

OpenStudy (nick67):

value is entered with "cin >> value" from the user

OpenStudy (anonymous):

return 0; wat is this

OpenStudy (nick67):

At the end of a function (in this case the "main" function) you use a return to exit the function; in this case the value is returned to the program caller, i.e. the O.S. Usually a program without errors returns 0

OpenStudy (anonymous):

@nick67 do u have c++ V 3.5

OpenStudy (anonymous):

or any version of c++

OpenStudy (anonymous):

@nick67

OpenStudy (anonymous):

Can u send me that or plzz provide a link to download it ..)))

OpenStudy (nick67):

I use Eclipse with C++ on Linux

OpenStudy (anonymous):

u have LINUX.................oh....no i am on WiNDOWS 7

OpenStudy (nick67):

try this: http://www.bloodshed.net/devcpp.html it's a bit old but works

OpenStudy (anonymous):

thxxx

OpenStudy (nick67):

for students I strongly suggest to switch to GCC compiler as soon as possible

OpenStudy (anonymous):

is this same as Borland C++

OpenStudy (anonymous):

@nick67

OpenStudy (nick67):

I don't know, because I don't use Borland anymore, but give a chance to the GNU/Linux world :-)

OpenStudy (nick67):

and as IDE take into consideration Eclipse framework; it's very flexible and let you to do many things http://www.eclipse.org

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!