Please helperror: no matching function for call to 'getline(std::istream&, int&, char)'|

Write your question here.
I am trying to learn c++ from a book and I had to do a few exercises
and this was the question.

1. Ask the user for two users' ages, and indicate who is older; behave differently if both are over
100.

And below is the code, But I faced multiple errors, Can u kindly guide me into where I have done wrong.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  #include <iostream>
#include <string>
using namespace std;


int main()

 {
  string first_user ;
string second_user ;
int first_age;
int second_age;

cout << "1st user name: " << "\n" ;
getline (cin,first_user , '\n');
cout << "1st user age: " << "\n" ;
getline (cin,first_age , '\n');

cout << "2nd user name: " << "\n";
getline (cin,second_user, '\n');
cout << "2nd user age: " << "\n";
getline (cin,second_age, '\n') ;


if (first_user > second_user)
{
    cout << first_user "is older than " second_user << "\n";
}
   else if (second_user > first_user)
   {
       cout << second_user "is older than " first_user << "\n"
   }

 }




And this is the error I get

||=== Build: Debug in Boolean (compiler: GNU GCC Compiler) ===|

C:\Users\Ahsen\Documents\CodeBlock Projects\Boolean\main.cpp|17|error: no matching function for call to 'getline(std::istream&, int&, char)'|
getline don't work with integers, only strings.
line 25 and line 29, you're comparing names not ages.

Also, you're not handling the case where the two ages are the same.

Topic archived. No new replies allowed.