Hello Everybody!! I want to Challenge "Pig Latin" in C++ I did That Challenge but in there 3 and 5 tests Showing Error,... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello Everybody!! I want to Challenge "Pig Latin" in C++ I did That Challenge but in there 3 and 5 tests Showing Error,...

What should I do?!. Please Help me!!!!

6th Feb 2020, 11:20 PM
#MUHAMMED
#MUHAMMED - avatar
5 Answers
+ 2
your code assumes there are only three strings in input. which is not true for all cases. I tried it with "hello" and got "ellohay ay ay" also what happens if the input is > 3 strings.
7th Feb 2020, 12:07 AM
Bahhaⵣ
Bahhaⵣ - avatar
6th Feb 2020, 11:20 PM
#MUHAMMED
#MUHAMMED - avatar
0
👆 This Code...... --- Pig Latin ---
6th Feb 2020, 11:22 PM
#MUHAMMED
#MUHAMMED - avatar
0
Oops😕.. I forgot. About That!! bahha🐧 Thanks so much!🙏
7th Feb 2020, 3:33 AM
#MUHAMMED
#MUHAMMED - avatar
0
#include <iostream> #include <string> int main() { //std::vector<std::string> finish; for (int i = 0; i < 4; i++) { std::string temp; std::cin >> temp; if (!temp.empty()){ temp = temp + temp[0] + "ay"; //finish.push_back(temp); temp.erase(0, 1); std::cout << temp << " "; temp.erase(0, sizeof(temp)); } } //28 }
30th Jan 2021, 5:06 AM
Sou o PeddoBear (PeddoRicko)
Sou o PeddoBear (PeddoRicko) - avatar