Hello, and thank you for hwlping me with this run-in with trouble.
I am making a script for pig latin transulation, and there is something wrong with the "if" statement in line 51. Here is the code so far:
Please post code when you reply to this post. Thank you.
By the way, here are my compiler/envirnment specs.:
Envirnment : Dev-C++ 4.9.9.2
Compiler : GCC.exe
I am making a script for pig latin transulation, and there is something wrong with the "if" statement in line 51. Here is the code so far:
Code:
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
string platin(string original);
int main()
{
string bub;
do {
cout << "Enter One Word: ";
getline (cin, bub);
cout << "\n\nOriginal : " << bub << endl;
cout << "Pig Latin: " << platin(bub) << "\n\n" << endl;
} while (bub != "exit");
return 0;
}
string platin(string original)
{
string a;
string b;
string c;
string d;
string e;
string final;
int positionOne = 0;
int positionTwo = 0;
int positionThree = 0;
positionTwo = original.find(" ", positionThree);
positionThree = positionTwo;
a = original.substr(positionOne, (positionTwo - positionOne));
b = a[0];
c = a.substr(0, 2);
d = a.substr(0, 3);
if ((b == "a") || (b == "e") || (b == "i") || (b == "o") || (b == "u")) {
e = original + "yay";
}
else if (original == "nix") {
e = "ixnay";
}
else if (original == "scram") {
e = "amscray";
}
else if (original == "hour") {
e = "houray";
}
else if ((c == "aa") || (c == "ae") || (c == "ah") || (c == "ao") || (c == "aw") || (c == "ax") || (c == "ay") || (c == "ea") || (c == "eh") || (c == "er") || (c == "ey") || (c == "ia") || (c == "ih") || (c == "iy") || (c == "oh") || (c == "ow") || (c == "oy") || (c == "ua") || (c == "uh") || (c == "uw") || (c == "th") || (c == "dh") || (c == "sh") || (c == "zh") || (c == "ch") || (c == "jh") || (c == "ng") || (c == "hh") (c == "ph") || (c == "qu")) {
d = a.substr(2);
e = d + c + "ay";
}
else if ((d == b + "aa") || (d == b + "ae") || (d == b + "ah") || (d == b + "ao") (d == b + "aw") || (d == b + "ax") || (d == b + "ay") || (d == b + "ea") || (d == b + "eh") (d == b + "er") || (d == b + "ey") || (d == b + "ia") || (d == b + "ih") || (d == b + "iy") (d == b + "oh") || (d == b + "ow") || (d == b + "oy") || (d == b + "ua") || (d == b + "uh") (d == b + "uw") || (d == b + "th") || (d == b + "dh") || (d == b + "sh") || (d == b + "zh") (d == b + "ch") || (d == b + "jh") || (d == b + "ng") || (d == b + "hh") || (d == b + "ph") (d == b + "qu") || ) {
c = a.substr(3);
e = c + d + "ay";
}
else {
c = a.substr(1);
e = c + b + "ay";
}
positionOne = positionTwo;
final = final + e;
return final;
}
By the way, here are my compiler/envirnment specs.:
Envirnment : Dev-C++ 4.9.9.2
Compiler : GCC.exe
Comment