Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part B: Pig Latin Step 1: Requirements Write a program that will input a phrase

ID: 3543120 • Letter: P

Question

Part B: Pig Latin

Step 1: Requirements

Write a   program that will input a phrase and convert it to pig latin. Put each word   in a separate element of a string array. Remove the first letter from each   word and concatenate it to the end of the word followed by

  

Part B: Pig Latin

     

Step 1: Requirements

     

Write a   program that will input a phrase and convert it to pig latin. Put each word   in a separate element of a string array. Remove the first letter from each   word and concatenate it to the end of the word followed by

Explanation / Answer

Dear,

You haven't specified the language you are looking for to implement piglatin program giving you C++ code still any further assistance needed gat back to me:

//Header file section

#include<iostream>           //   Allows program to perform input and output

using namespace std;

void printLatinWord(char *); //   Prototype for the function

int main()                   //   function main begins program execution

{

     //   Declare two variables of character array

     char phrase[1000];

     char *token;

     //   prompt the user for input

     cout << " A program to encode English Language phrase into Pig Latin";

     cout << " Enter a line (use <new line> as the delimiter) : ";

     //   read the input from the user

     cin.getline(phrase,1000, ' ');

          //   extract the first token

     token = strtok( phrase, " " );

    

     /* While there are tokens in "string" */

     while( token != NULL )

     {

          //   call the print latin word function

          printLatinWord(token);

          //   insert a blank according to the phrase

          cout << " ";

          /* Get the next token: */

          token = strtok( NULL, " " );

     }

     system("pause");

     return 0;     // indicate program executed successfully

}                  // end of function, main

//   prints the pig latin word

void printLatinWord(char *word)

{

     //   sepearate the first letter

     char firstletter = *word;

     word++;

     //   print the other letters

     while (*word != '')

     {

          cout << *word;

          word++;

     }

     //   print the first letter and "ay"

     cout << firstletter << "AY";

}//end    printLatinWord