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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started