Now... Before we get all uppity here, yes, this is a homework problem. I'm not asking for an answer, but for direction.. Because I have no idea why it isn't working
Compiler output:
(There are other outputs that I've stumbled across, but this is the one I'm getting now, after re-writing it again thinking I made a typo or something)
The problem bits of code I know are lines 6, 13, and 30. The homework instructions tell me to use a certain main function and function prototypes. Everything else can change, just not those.
Now, if I change line 30 to this,
it will output... I just don't know how to get the value stored in find_min() to carry over to print_min() without having extra variables.
This is a small part of a larger program.. And this is the only one I'm having trouble with, so instead of posting the entire thing, I'm just posting this.
Thank you for any help
BTW: Admins, what are the chances we'll get syntax hi-lighting in the "code" tags? That'd be pretty neat.
Code:
#include <iostream>
using namespace std;
int get_input(int &, int &);
int find_min(int, int);
int print_min(int);
int main()
{
int num1, num2;
get_input(num1, num2);
print_min(find_min(num1, num2));
return 0;
}
int get_input(int &num1, int &num2)
{
cout << "Number 1: "; cin >> num1;
cout << "Number 2: "; cin >> num2;
}
int find_min(int num1, int num2)
{
if (num1 < num2)
return num1;
if (num2 < num1)
return num2;
}
int print_min(int find_min())
{
cout << "TEST OUTPUT" << endl;
}
Compiler output:
Code:
ifargle@mint /mnt/samba/CS221/HW 6 $ sudo g++ -o hw6 hw6.cpp
/tmp/ccfJSewM.o: In function `main':
hw6.cpp:(.text+0x35): undefined reference to `print_min(int)'
collect2: ld returned 1 exit status
The problem bits of code I know are lines 6, 13, and 30. The homework instructions tell me to use a certain main function and function prototypes. Everything else can change, just not those.
Now, if I change line 30 to this,
Code:
int print_min(int num1)
This is a small part of a larger program.. And this is the only one I'm having trouble with, so instead of posting the entire thing, I'm just posting this.
Thank you for any help
BTW: Admins, what are the chances we'll get syntax hi-lighting in the "code" tags? That'd be pretty neat.