Just starting out in this programming adventure, and I've run into a problem already with my getline function and else if.
Here is my code:
#include <iostream>
using namespace std;
int main ()
{
int billy;
int jill;
cout << "How old is Billy? " << "\n";
getline( cin, billy, '\n');
cout << "Okay! Now, how old is Jill? " << "\n";
getline ( cin, jill);
if ( ( billy > 100 ) && ( jill > 100 ) );
{
cout << "Wow! Those guys are ******* old!";
}
else if ( billy > jill );
{
cout << "Okay, so Billy is older than Jill. Expected.";
}
else ( billy < jill );
{
cout << "Wait, so Jill was older than Bill? Interesting.";
}
}
Now it my compiler (I'm using code::blocks) says that there's no matching function for all to getline. It works just fine if I switch it to:
cin >> billy
So, I'm not sure what's wrong with the code. I've reread the instruction book I have explaining getline, but it doesn't exactly explain the full use of it.
And secondly, when I switch the getline to cin >>, when my compiler get's to the else if statement, it says: error: 'else' without a previous 'if'
So, thanks ahead of time for any help, I'd definitely like to get past this point, and I don't want to move on before fully understanding what I've learned.