[URI Online Judge] – 1049 – Animal

In this problem, your job is to read three Portuguese words. These words define an animal according to the table below, from left to right. After, print the chosen animal defined by these three words.

Input

The input contains 3 words, one by line, that will be used to identify the animal, according to the above table, with all letters in lowercase.

Output

Print the animal name according to the given input.

Sample Inputs Sample Outputs
vertebrado
mamifero
onivoro
homem
vertebrado
ave
carnivoro
aguia
invertebrado
anelideo
onivoro
minhoca

Solution:

#include <cstdio>
#include <iostream>
using namespace std;
int main(){
 std::string a, b, c;
 cin >> a;
 cin >> b;
 cin >> c;
 if (a == "vertebrado"){
 if (b == "ave"){
 if (c == "carnivoro")
 printf("aguia\n");
 else
 printf("pomba\n");
 } else {
 if (c == "onivoro")
 printf("homem\n");
 else
 printf("vaca\n");
 }
 } else {
 if (b == "inseto"){
 if (c == "hematofago")
 printf("pulga\n");
 else
 printf("lagarta\n");
 } else {
 if (c == "hematofago")
 printf("sanguessuga\n");
 else
 printf("minhoca\n");
 }
 }
 return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s