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!!!!
5 ответов
+ 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.
0
👆 This Code...... --- Pig Latin ---
0
Oops😕.. I forgot. About That!!
bahha🐧 Thanks so much!🙏
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
}