Pig Latin Help

I am trying to input a string and have the pig latin version print out. I am not getting any errors but the code is not working right.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <string>
#include <cctype>
#include <ctime>

using namespace std;





int main() {
	string word;
	cout << "Enter a word" << endl;
	cin >> word;
	string first;
	first = word[0];
	
	string x = first + "ay";
	x = x[1, x.length()];
	cout << x;
	system("pause");
	return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
#include <cctype>
#include <ctime>

using namespace std;

int main() 
{
	string word;
	cout << "Enter a word" << endl;
	cin >> word;
	
	char c = word[0];
	word.erase(word.begin());
	word = word + c + "ay";
	
	cout << word;
	system("pause");
	return 0;
}


http://cpp.sh/35z5j
Last edited on
Topic archived. No new replies allowed.