#include
#include
using namespace std;
const int SIZE = 80;
void printLatinWord( char const *const );
int main()
{
char sentence[SIZE], *tokenPtr;
cout << "Enter a sentence:\n";
cin.getline( sentence, SIZE );
cout << "\nThe sentence in Pig Latin is:\n";
tokenPtr= strtok_s( sentence, " " ,NULL);
while ( tokenPtr!=NULL ) {
printLatinWord( tokenPtr );
tokenPtr = strtok_s( NULL, " ",NULL );
//if ( tokenPtr )
cout << ' ';
}
cout << '.' << endl;
return 0;
}
void printLatinWord( char const * const wordPtr )
{
int len = strlen( wordPtr );
for (int i = 1; i < len; ++i )
cout << *( wordPtr + i );
cout << *wordPtr << "ay";
}