| sam dhillon (6) | |
|
i have written a program which adds and subtracts with functions (copied out of the book)the addition works. However when i call the subtraction function,it doesn't takeaway, it only adds. // // // #include<iostream.h> #include<math.h> using namespace std; //functions. //addition double adding(int x,int y){ int b=y+x; cout<<"="<<b<<endl; return b; }; //subtraction double sub_traction(int a,int c){ int h=a-c; cout<<"="<<h<<endl; return h; }; //program int main (){ int sum; int sum1; cin>>sum>>sum1; sub_traction(sum,sum1); } | |
|
|
|
| Program Programmer (39) | |||
Let me fix this....
i think i fixed it im not sure | |||
|
Last edited on
|
|||
| Framework (3237) | |||||||||||||||||
C headers, not C++.
Truncation. Why return "double" if the decimal is removed?
Truncation. Same as above.
...doesn't return anything. Wazzak | |||||||||||||||||
|
Last edited on
|
|||||||||||||||||