passing parameters with functions 
Author Message
 passing parameters with functions

i need help making a program that requests a floating-point number and prints
the value of the number cubed using a function to cube the value and print it.
Also, the main() program has to pass the entered value to this function.
HELP!!!!!



Sat, 15 Mar 2003 03:00:00 GMT  
 passing parameters with functions

Quote:

> i need help making a program that requests a floating-point number and prints
> the value of the number cubed using a function to cube the value and print it.
> Also, the main() program has to pass the entered value to this function.
> HELP!!!!!

You forgot to include your teacher email address: I need it to send the
program directly to him, and suppress all your work.
What you are trying to do is trivial. Post your code, and you will
receive lots of comments.

--
Luis Grave



Sat, 15 Mar 2003 03:00:00 GMT  
 passing parameters with functions

Quote:

> i need help making a program that requests a floating-point number and prints
> the value of the number cubed using a function to cube the value and print it.
> Also, the main() program has to pass the entered value to this function.

If you show us the code you've come up with, we'll tell you
what's wrong with it.


Sat, 15 Mar 2003 03:00:00 GMT  
 passing parameters with functions

Quote:

> i need help making a program that requests a floating-point number and prints
> the value of the number cubed using a function to cube the value and print it.
> Also, the main() program has to pass the entered value to this function.
> HELP!!!!!

Use fgets to get data from the user.
Use strtod to turn it into floating point form.
To cube n, storing the result in c, do this: c = n * n * n;

Now it's your turn. Write some code. We'll help if you get stuck, but we
won't do the work for you.

--
Richard Heathfield
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
65 K&R Answers: http://users.powernet.co.uk/eton/kandr2/index.html (32
to go)



Sun, 16 Mar 2003 14:48:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing C++ Class Member Function to as a C Callback Function Parameter

2. calling C++ function from Fortran: parameter passing

3. how do I pass arrays as parameters to functions - newbie

4. parameters pass between function and main

5. Passing parameters to a Thread'ed function

6. Pass parameter to a function

7. function passed as parameter....

8. Pb with passing a function as parameter

9. Passing parameters to a function

10. passing unknown number of parameters to a function

11. optional parameter passing in Turbo C functions

12. Passing string literals as function parameters...

 

 
Powered by phpBB® Forum Software