Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Please help me to write the code for #2 // Plurals // Set variable islands to iles // Set variable len to the size
C++
Please help me to write the code for #2
// Plurals // Set variable islands to "iles" // Set variable len to the size of the string country // Set variable last to the last two characters in country // If any of these are true // country starts with the value in islands. (use substr) OR // last is one of "es", "is","os", or "as" // Then set prefix to "les ". (space)
// Processing section /7 Country end in letter e or o? Feminine prefix-la (space) // Otherwise? Masculine prefix->le (space) // With these exceptions // Belize Cambodge Mexique Mozambique Zaire Zimbabwe Call le) // Starts with a vowel? prefix 1' (no space) /7 Plural? prefix is les (space) /7 Israel, Madagascar, Sri Lanka, Singapore, Monaco, // Cuba and Cyprus have no prefix string prefix; // Plurals // Set variable islands to "iles" // Set variable len to the size of the string country /7 Set variable last to the last two characters in country / If any of these are true / country starts with the value in islands. Cuse substr OR // last is one of "es", "is", "os", or "as" // Then set prefix to "les". (space) string islands"iles" string len-country.lengthO; string last country.substr(len - 2); if (country.substr(0, islands)islands Lastes' lastis' ll last == 'os* 11 last-"as') prefix - "les
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started