How do I make both my integer and double functions add its numbers?
I just wrote a brand new code based on two functions: ints and doubles. However, whenever I compile the program, I can't get the changes that I want from both functions. The first function is supposed to add 1 to both 3's included for x and y while the second function adds 1.5 to both a and b. #include <iostream> using namespace std; int myFunction(int &a); double myFunctions(double &b); int main() { int x = 3; int y = 3; double a = 4.0; double b = 4.0; cout << x << " and " << y << " are the chosen numbers." << endl << endl; cout << "The numbers above share the same first function: " << endl; myFunction(x); myFunction(y); cout << "\nx is now: " << x; cout << "\ny is now: " << y << endl << endl; cout << a << " and " << b << " are the new chosen numbers." << endl << endl; cout << "The new numbers above share the same second function: " << endl; myFunctions(a); myFunctions(b); cout << "\na is now: " << a; cout << "\nb is now: " << b << endl; } int myFunction(int &a) { int new_a = a + 1; return (new_a); } double myFunctions(double &b) { double new_b = b + 1.5; return (new_b); } And one more question, can a function be used to convert an int into a double or a double to int? And an int or a double share the exact same function?