Question

Sixth: Pig Latin (10 Points) For this part of the assignment, you will need to write a program that reads an input string rep

In C

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <stdio.h>
#include<string.h>

int main()
{
    char str1[100],temp2[100],temp3[100],*str,*temp,*temp1;
    printf("Hello, World!\n");
    str=str1;
    temp=temp2;
    temp1=temp3;
gets(str1);
while(*str!='\0')
{
    
    while(*str==' ')
        {
             str=str+1;
        }
        
    if(*str=='a'||*str=='e'||*str=='i'||*str=='o'||*str=='u')
        {
            
             while(*str!=' ')
             {
                 *temp=*str;
                  str=str+1;
                  temp=temp+1; 
             }
             
             *temp='a';
              temp=temp+1; 
             *temp='y';
              temp=temp+1; 
             *temp=' ';
        
        }
        else
        {
                    *temp1=*str;
                     temp1++;
                     str++;
                while(*str!='a'||*str!='e'||*str!='i'||*str!='o'||*str!='u')
                 {
                     *temp1=*str;
                      temp1=temp1+1; 
                     str=str+1;    
                 }
                 *temp1='\0';
                 while(*str!=' ')
                 {
                     *temp=*str;
                     str=str+1;
                     temp=temp+1; 
                 }
                 
               *temp='\0';
                 strcat(temp,temp1);
                 
                 str=str+1;
                 temp=temp+1; 
                  *temp='y';
                *temp='a';
              temp=temp+1; 
             *temp='y';
                 temp=temp+1;    
               
        }
        
        
        
    
}

            
*temp='\0';
puts(temp);
    return 0;
}

Add a comment
Know the answer?
Add Answer to:
In C Sixth: Pig Latin (10 Points) For this part of the assignment, you will need...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Pig Latin Translator in Java The goal here is to read in the characters stored in a text file and create a second text file that contains the original text but with every word converted to “Pig-Latin....

    Pig Latin Translator in Java The goal here is to read in the characters stored in a text file and create a second text file that contains the original text but with every word converted to “Pig-Latin.” The rules used by Pig Latin are as follows: • If a word begins with a vowel, just as "yay" to the end. For example, "out" is translated into "outyay". • If it begins with a consonant, then we take all consonants before...

  • In C please Pig latin has two very simple rules: If a word starts with a...

    In C please Pig latin has two very simple rules: If a word starts with a consonant move the first letter(s) of the word, till you reach a vowel, to the end of the word and add "ay" to the end. have ➞ avehay cram ➞ amcray take ➞ aketay cat ➞ atcay shrimp ➞ impshray trebuchet ➞ ebuchettray If a word starts with a vowel add "yay" to the end of the word. ate ➞ ateyay apple ➞ appleyay...

  • Pig Latin program using Linked Lists C++

    Write a program that prompts the user to input a string and then outputs the string in the pig Latin form. The rules for converting a string into pig Latin form are asfollows:a. If the string begins with a vowel, add the string "-way" at the end of the string. for example, the pig Latin form of the string "eye" is "eye-way".b. If the string does not begin with a vowel, first ass "-" at the end of the string....

  • Design and code a SWING GUI to translate text entered in English into Pig Latin. You...

    Design and code a SWING GUI to translate text entered in English into Pig Latin. You can assume that the sentence contains no punctuation. The rules for Pig Latin are as follows: For words that begin with consonants, move the leading consonant to the end of the word and add “ay”. Thus, “ball” becomes “allbay”; “button” becomes “uttonbay”; and so forth. For words that begin with vowels, add “way’ to the end of the word. Thus, “all” becomes “allway”; “one”...

  • use C++ Pig Latin Background Pig latin is a "language” where you take the regular English...

    use C++ Pig Latin Background Pig latin is a "language” where you take the regular English Word, remove the first letter, place it on the end of the word, and then append "ay" to the end of the word. Pig Latin = Igpay Atinlay Functionality 1) Prompt the user to enter any input string (I will test it with multiple words). 2) After receiving and storing (if needed) their input, change their words to Pig Latin by placing the first...

  • There is a children's "secret language" called "Pig Latin" which supposedly allows conversation the uninformed (such...

    There is a children's "secret language" called "Pig Latin" which supposedly allows conversation the uninformed (such as parents) cannot understand. The rules are: If a word begins with a vowel (aeiou) then append "way" to the word. For example, "Aggie" becomes "Aggieway". Otherwise, remove the consecutive non-vowels from the beginning of the word, append them to the end of the word, and append "ay" to the word. For example, "whoop" becomes "oopwhay". Write a program named hw5pr1.cpp which reads words...

  • Write the Java code for the class WordCruncher. Include the following members:

    **IN JAVAAssignment 10.1 [95 points]The WordCruncher classWrite the Java code for the class WordCruncher. Include the following members:A default constructor that sets the instance variable 'word' to the string "default".A parameterized constructor that accepts one String object as a parameter and stores it in the instance variable. The String must consist only of letters: no whitespace, digits, or punctuation. If the String parameter does not consist only of letters, set the instance variable to "default" instead. (This restriction will make...

  • /** * Returns the result of converting s to "Pig Latin". Convert a string s to...

    /** * Returns the result of converting s to "Pig Latin". Convert a string s to Pig Latin by using the following rules: * * (1) If s contains no vowels, do nothing to it. * * (2) Otherwise, if s starts with a vowel, append "way" to the end. * * (3) Otherwise, move everything up to (but not including) the first vowel to the end and add "ay". * * For example, "hello" converts to "ellohay", "small" converts...

  • String variables/Selection & loop Write a complete Java program which prompts the user for a sentence on one line wh...

    String variables/Selection & loop Write a complete Java program which prompts the user for a sentence on one line where each word is separated by one space, reads the line into one String variable using nextline(), converts the string into Ubbi dubbi and displays the translated sentence. Ubbi dubbi works by adding ub before each vowel sound in a syllable. For example, hello becomes hubellubo. The word speak has the vowel sound ea, so in Ubbi dubbi it becomes spubeak....

  • In Java please Only use methods in the purpose. Thank you The purpose of this assignment is to help you learn Java iden...

    In Java please Only use methods in the purpose. Thank you The purpose of this assignment is to help you learn Java identifiers, assignments, input/output nested if and if/else statements, switch statements and non-nested loops. Purpose Question 2-String variables/Selection & loops. (8.5 points) Write a complete Java program which prompts the user for a sentence on one line where each word is separated by one space, reads the line into one String variable using nextline), converts the string into Ubbi...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT