Robert Ryan wrote: > actually, i am trying to get this done in C++. I should have made this in > C++, what was i thinking >> [email protected] wrote: >>> #include <stdio.h> >>> >>> int add (int x, int y) { >>> int z; >>> z = x + y; >>> return (z); >>> } >>> main () >>> { >>> int i, j, k; >>> i = 10; >>> j = 20; >>> k = add(i, j); >>> printf ("The value of k is %d\n", k); >>> } >>> how do you change the above code to the following >>> >>> + (2, 6) >>> - ( 2, 6)
Assuming you mean that you want to do something like: k = operator+(2, 6); Adding two 'int's is a primitive operation. You can't overload operators for primitives. That's an ANSI C++ Standard restriction. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
