URI-1049-no-solution in c++

URI Online Judge Solution | 1049 || Animal

Problem No:1049
Problem Level:Beginner
Online Judge:URI
Problem Link:https://www.urionlinejudge.com.br/judge/en/problems/view/1049
 

Solution in C++

Source Code:

#include <iostream>
#include <cstring>
#include <stdlib.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string c;

  cin >> c;

  if(c == "vertebrado"){

   cin >> c;
   if(c == "ave"){

    cin >> c;
    if(c == "carnivoro"){
     cout << "aguia" << endl;
    }else{
     cout << "pomba" << endl;
    }
   }else{

    cin >> c;
    if(c == "onivoro"){
     cout << "homem" << endl;
    }else{
     cout << "vaca" << endl;
    }
   }
  }else{

   cin >> c;
   if(c == "inseto"){

    cin >> c;
    if(c == "hematofago"){
     cout << "pulga" << endl;
    }else{
     cout << "lagarta" << endl;
    }
   }else{

    cin >> c;
    if(c == "hematofago"){
     cout << "sanguessuga" << endl;
    }else{
     cout << "minhoca" << endl;
    }
   }
  }
  return 0;
}

Explanation:

Here you have to take three string and the use simple if else statement to find the combination of the table given.Then you have to print the answer.
 


No comments

Powered by Blogger.