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

Please make the following old fashion code into the modern fashionexecutable C l

ID: 3615673 • Letter: P

Question

Please make the following old fashion code into the modern fashionexecutable C language in all environments.

   #include "stdafx.h"
    #include <iostream>
    #include <string>
    #include <cstdlib>
    using namespace std;
    bool isVowel(char ch);
    string rotate(string pStr);
    string pigLatinString(string pStr);
   int main ()
   {      const int LENGTH = 80;
     char str [LENGTH];
      vowels = ["a", "e","i", "o", "u", "A", "E", "I", "O", "U", "y","Y"]       consonants = ["b", “c","d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s","t", "v", "w", "x", "z", "B", “C", "D", "F", "G", "H", "J","K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X","Z"]       consonant_string = ""         string word, result;
    cout << "Enter a string or, blankto exit." <<endl;
      cout << "The program will outputthe words in Pig Latin."<<endl;
    cin.getline(str,LENGTH);
     cout<<endl;
      cout << "The pig Latin form of" << str <<" is: "<< pigLatinString(str)<< endl;
      return 0;
};
bool isVowel(char ch)
{
    switch (ch)
     {
      case 'A': case 'E':
       case 'I': case 'O':
       case 'U':
       case 'a': case 'e':
       case 'i': case 'o':
       case 'u':
       return true;
       default: return false;
    };
}
   string rotate(string pStr)
   {
     string::size_typelen=pStr.length();
      string rStr;
     rStr=pStr.substr(1,len-1)+pStr[0];
      return rStr;
   }
   string pigLatinString(string pStr)
   {
    string::size_type len;
     bool foundVowel;
     string::size_type counter;
     if (isVowel(pStr[0]))
     pStr=pStr+"tay";
     else
     {
       pStr = pStr + "";
        pStr=rotate(pStr);
        len=pStr.length();
        foundVowel=false;
       for (counter = 1;counter<len-1; counter++)
        if(isVowel(pStr[0]))
        {
         foundVowel=true;
         break;
        }
       else
         pStr=rotate(pStr);
         if (!foundVowel)
        pStr=pStr.substr(1,len)+"tay";
         else
         pStr = pStr +"ay";
   }
    return pStr;
}

   #include "stdafx.h"
    #include <iostream>
    #include <string>
    #include <cstdlib>
    using namespace std;
    bool isVowel(char ch);
    string rotate(string pStr);
    string pigLatinString(string pStr);
   int main ()
   {      const int LENGTH = 80;
     char str [LENGTH];
      vowels = ["a", "e","i", "o", "u", "A", "E", "I", "O", "U", "y","Y"]       consonants = ["b", “c","d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s","t", "v", "w", "x", "z", "B", “C", "D", "F", "G", "H", "J","K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X","Z"]       consonant_string = ""         string word, result;
    cout << "Enter a string or, blankto exit." <<endl;
      cout << "The program will outputthe words in Pig Latin."<<endl;
    cin.getline(str,LENGTH);
     cout<<endl;
      cout << "The pig Latin form of" << str <<" is: "<< pigLatinString(str)<< endl;
      return 0;
};
bool isVowel(char ch)
{
    switch (ch)
     {
      case 'A': case 'E':
       case 'I': case 'O':
       case 'U':
       case 'a': case 'e':
       case 'i': case 'o':
       case 'u':
       return true;
       default: return false;
    };
}
   string rotate(string pStr)
   {
     string::size_typelen=pStr.length();
      string rStr;
     rStr=pStr.substr(1,len-1)+pStr[0];
      return rStr;
   }
   string pigLatinString(string pStr)
   {
    string::size_type len;
     bool foundVowel;
     string::size_type counter;
     if (isVowel(pStr[0]))
     pStr=pStr+"tay";
     else
     {
       pStr = pStr + "";
        pStr=rotate(pStr);
        len=pStr.length();
        foundVowel=false;
       for (counter = 1;counter<len-1; counter++)
        if(isVowel(pStr[0]))
        {
         foundVowel=true;
         break;
        }
       else
         pStr=rotate(pStr);
         if (!foundVowel)
        pStr=pStr.substr(1,len)+"tay";
         else
         pStr = pStr +"ay";
   }
    return pStr;
}

Explanation / Answer

#include #include #include using namespace std;bool isVowel(char ch);char * rotate(char * pStr);char * pigLatinString(char * pStr);int main (){const int LENGTH = 80;char str [LENGTH];char * vowels[] = {"a", "e", "i", "o", "u", "A", "E", "I", "O", "U", "y", "Y"};char * consonants[] = {"b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z", "B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Z"};char *consonant_string = "" ;char * word, result;printf( "Enter a char * or, blank to exit." );printf( "The program will output the words in Pig Latin.");scanf("%s",str);//cin.getline(str,LENGTH);printf(" ");printf( "The pig Latin form of %s is:%s ",str,pigLatinString(str));system("pause");return 0;};bool isVowel(char ch){switch (ch){case 'A': case 'E':case 'I': case 'O':case 'U':case 'a': case 'e':case 'i': case 'o':case 'u':return true;default: return false;};}char * rotate(char * pStr){char *rStr=(char *)malloc(strlen(pStr)+1);sprintf(rStr,"%s%c",&pStr[1],pStr[0]);return rStr;}char * pigLatinString(char * pStr){bool foundVowel;int counter,len;if (isVowel(pStr[0]))strcat(pStr,"tay");else{strcat(pStr , "");pStr=rotate(pStr);len=strlen(pStr);foundVowel=false;for (counter = 1; counter
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote