Advertisement
andre_qramos

Maior Idade

Sep 4th, 2020
1,270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<iostream>
  2. #include <math.h>
  3. #include <iomanip>
  4. #include <cstdio>
  5. #include <string>
  6. using namespace std;
  7.  
  8. int main() {
  9.     string name1, name2;
  10.     int age1, age2;
  11.     cin >> name1;
  12.     cin >> age1;
  13.     cin >> name2;
  14.     cin >> age2;
  15.     if(age1 == age2){
  16.         printf("Idades iguais\n");
  17.         return 0;
  18.     }
  19.     if(age1 > age2){
  20.         printf("%s\n", name1.c_str());
  21.         return 0;
  22.     }
  23.     else{
  24.         printf("%s\n", name2.c_str());
  25.         return 0;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement