![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
How to turn if else statements from math....into functions???Hello,
I got the program to work as follows: but i need to convert everything to functions. Here is the program working before I tried converting to functions: CPP / C++ / C Code:
and here is my attempt at just converting the add function: CPP / C++ / C Code:
any help on just getting the add function to work...thank you |
|
#2
|
|||
|
|||
Re: How to turn if else statements from math....into functions???Hello,
Hey I figured out how to get the functions to work... but for some reason i cant get the division to work when the program runs... it just exits out of the program... i believe it has something to do with unitialized z variable... can someone please help explain this....thank you here is the code: CPP / C++ / C Code:
|
|
#3
|
|||
|
|||
Re: How to turn if else statements from math....into functions???never mind.... can mods delete this thread??
I figured out that i needed to initialize z outside of the function... |
|
#4
|
|||
|
|||
Re: How to turn if else statements from math....into functions???It may help you to validate your input in the functions. For instance, in the division function, check to make sure that the denominator is not zero.
|
|
#5
|
|||
|
|||
Re: How to turn if else statements from math....into functions???Quote:
Yes, I added 1 to the random function so that 0 does not come up as a variable... Thank you.. |
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Undefined reference to pow | pisuke | C Programming Language | 6 | 02-Aug-2007 08:39 |
| Help with some functions | baka_yaro | CPP / C++ Forum | 3 | 14-Mar-2007 05:56 |
| Need help with if else statements and functions | mimi78 | CPP / C++ Forum | 4 | 07-Mar-2007 19:22 |
| C math functions | tnethaji | C Programming Language | 1 | 04-Jul-2005 06:03 |
| Pointers to Functions (was Saving some if statements) | TekiFreek | CPP / C++ Forum | 17 | 17-Jun-2004 11:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The