Question: Programming Language : C++ Write the functions using code provided IsVowel() Function: IsVowel Input: strIn as string If first character of strIn is a, e,

Programming Language : C++

Write the functions using code provided

IsVowel()

Function: IsVowel Input: strIn as string If first character of strIn is a, e, i, o, or u (upper or lower case) then Return true Else Return false End if

PigVowel

Function: PigVowel Input: strIn as string Set strOut = strIn If the last character of strIn is y then Append ay to strOut Else Append yay to strOut End if Return: strOut

PigConsonant

Function: PigConsonant Input: strIn as string Set strOut = strIn from 2nd character of strIn to last character or strIn Append first character of strIn to strOut Append ay to strOut Return: strOut

The main function will:

Store input in strInput If strInput is vowel strOutput is set by PigVowel Else strOutput is set by PigCononant End if Display strOutput

-----------------------------------------------------------------------------------------

#include "stdafx.h"

#include

#include

#include

using namespace std;

bool IsVowel(string strIn)

{

if (strIn.length() > 0)

{

char c;

c = toupper(strIn[0]);

if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')

return true;

}

return false;

} string PigVowel(string strIn)

{

string strOut; return strOut;

} string PigConsonant(string strIn)

{

string strOut;

return strOut;

}

int _tmain(int argc, _TCHAR* argv[])

{ string strInput = "";

int iPosition = 0;

string strOutput = "";

cout << "Pig Latin Interpreter" << endl << endl;

cout << "Enter a word in English: ";

cin >> strInput; cout << endl;

cout << "Pig Latin: " << strOutput << endl << endl; system("Pause");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!