can someone help me programming each of the following questions in simple c/c++
ID: 3807818 • Letter: C
Question
can someone help me programming each of the following questions in simple c/c++ ( with an explanation, please)
Problem write a program that prompts the user to enter a word. Convert the word to Pig Latin by moving the first letter to the end of the word and adding "ay" to the end. For example, Tuesday becomes u Tay Repeat this process until the user types STOP. Problem 2 The a c program is executed, the main function is called with two arguments, argo and argv first, argc, is the number of arguments the program was called with. The second, start pointer to an array of strings that contain the arguments. This mechanism p a way to a program and pass it arguments directly from the command line. As an example, the following program prints whatever arguments are on the command line when the program is executed. includeExplanation / Answer
#include<iostream>
#include <string>
using namespace std;
string convertPiglatin(string); // This function will return a "piglatined" string
int main ()
{
string inputstr,ch; // The unsorted word
do{
cout << "Enter a string to convert: ";
cin >> inputstr;
cout << endl << "The Piglatin version of string is " << convertPiglatin(inputstr)+" ";
cout<<"Please enter 'STOP' to exit or any input to continue :";
cin>>ch;
}while(ch!="STOP");
return 0;
}
string convertPiglatin(string _inputstr)
{
int start = 0; // The end and start a substring
int end = _inputstr.size();
string prePig; // This is the string in which the substring will be stored
prePig = _inputstr.substr(1, end); //Here I'm making the substring
return prePig+_inputstr.at(0)+"ay";
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.