Hello,
It might help to know what type of calculator program you are looking for. You might want to structure it so that the user has to input a function...
Welcome to the Calculator Program.
Would you like to Add, Subtract, Divide, or Multiply (A,S,D,M)?
You chose to _
Please enter in your 1st Number: __
Please enter in your 2nd Number: __
Your answer is: ____
Would you like to calculate another?
Now, keep these things in mind:
* DO NOT ALLOW YOUR COMPUTER TO DIVIDE BY ZERO. That could crash out the computer, and give the user a nasty message. Put a check in there to ensure that b <> 0
* Be careful with the imaginary numbers. Review how they work.
* If you have to add trig functions, then make sure they follow the rules too.
* How are you going to handle exponents?
Some enhancement ideas:
* Implement a memory function that can store a value to be compared with later.
* Implement a small array, say 25 numbers, that you can average together or sort out (kinda like an adding machine thing).
Christian
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
>according to my notes its right
And your notes have to be correct? Nope, sorry.
>void main()
int main ( void )
>int enter_operator;
char enter_operator;
>scanf ("%d",&enter_operator);
scanf ("%c",&enter_operator);
>if (enter_operator = +);
if (enter_operator == '+')
>if (enter_operator = -)
else if (enter_operator == '-')
>}
return 0;
}
Clear?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>That,s no good either
Then you're doing it wrong.
>it's given me more errors
Please start giving us workable information instead of complaining about your mythical non-working code. Your idiocy isn't entertaining anymore. More specifically, post the errors you get, and the code that causes them.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
don't start a new thread when dealing with your old problem...
http://www.daniweb.com/techtalkforums/thread13701.html
and use code tags and hopefully indentation to make your code somewhat readable.
Have you tested what the value of your "enter_operator" actually is after the input?
Should it even go into one of your if-statements?
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
don't start a new thread when dealing with your old problem...
http://www.daniweb.com/techtalkforums/thread13701.html
and use code tags and hopefully indentation to make your code somewhat readable.
Have you tested what the value of your "enter_operator" actually is after the input?
Should it even go into one of your if-statements?
Went ahead and merged these two threads together. Let's make sure that we keep topics all inclusive in one thread.
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147