![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Programmer
Join Date: Apr 2005
Posts: 96
Rep Power: 4
![]() |
Well im learning c/c++ but I've ran into a slight snag while making an extreamly basic calculator. heres the code.
Quote:
|
|
|
|
|
|
|
#2 |
|
Programmer
Join Date: Feb 2005
Posts: 64
Rep Power: 4
![]() |
The problem is how you are trying to call the functions.
(int n1, int n2) // do not need to define the types here int multiply //int is the type of return value; you should assign the result of the function to a variable of type int (or you could just directly print the result without assigning it to a variable) example. int result; ... case 120: result = multiply(n1, n2); cout << result; break; or case 120: cout << multiply(n1, n2); break; |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Apr 2005
Posts: 96
Rep Power: 4
![]() |
oh!!! Ofcourse, I expected it to display without using the cout function. lol! thanks for the help.
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6
![]() |
you might want to use floats or doubles for this as integer division is kind of weird. :-)
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|