Question: anyone know whats wrong with my code? int run() { /* Implementation comments. input: enter french country and it will give you it gender outputs:

anyone know whats wrong with my code?

int run()

{

/*

Implementation comments.

input: enter french country and it will give you it gender

outputs: it will give the correct gender of the french country

given values: result, country

*/

// 1. Title and heading

cout

cout

// 2. Input section

cout

string country;

getline(cin, country);

// 3. Processing section

string result = "who knows?";

string prefix;

//7.handiling special cases

string plain = "Israel, Madagascar, Sri Lanka, Singapore, Monaco, Cuba, Cyprus";

string masculine = "Belize, Cambodge, Mexique, Mozambique, Zaire, Zimbabwe";

if(masculine.find(country))

{

prefix = "el ";

}

else if(plain.find(country))

{

prefix = "";

}

// 4. plural & genders

string islands = "iles";

int len = country.size();

string last = country.substr(len-2); // last two characters of country

if(country.substr(0,4) == islands || (last == "es" || last == "is" || last == "os" || last == "as"))

{

prefix = "les ";

}

//6. searching for vowels

string vowels = "AEIOU";

string first = country.substr(0,1);

if(vowels.find(first) != string::npos)

{

prefix = "l'";

}

// 5. ladies & gentleman

string lastCharacter = country.substr(len-1); // last one character of country

if(lastCharacter == "e" || "o")

{

prefix = "la ";

}

else

{

prefix = "le ";

}

result = prefix + country;

// 4. Output section

cout

return 0;

}

anyone know whats wrong with my code? int run() { /* Implementation

comments. input: enter french country and it will give you it genderoutputs: it will give the correct gender of the french country given

h05/ Input of Croatie->la Croatie Input of Bolivie->la Bolivie Input of Guyane->la Guyane X Input of Costa Rica: expected [le Costa Rica] but found [la Costa Rica] Input of Bulgarie->la Bulgarie Input of Turquie->la Turquie X Input of Etats-Unis: expected [les Etats-Unis] but found [la Etats-Unis] X Input of Honduras: expected [le Honduras] but found [la Honduras] X Input of iles Galapagos: expected [les iles Galapagos] but found [la iles Galapagos] Input of Trinite-et-Tobago->la Trinite-et-Tobago X Input of Angleterre: expected [l'Angleterre] but found [la Angleterre] X Input of Belize: expected [le Belize] but found [la Belizel Input of Suisse->la Suisse X Input of Mexique: expected [le Mexique] but found [la Mexiquel X Input of Bahamas: expected [les Bahamas] but found [la Bahamas] H05: soctavio: ALL TESTS -- PASS 7/15 (47%)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!