Question
(C++) This program echoes a word differently, depending on the word that is passed in. Usage... Modify code below please... Thank you! #include #include using
(C++) This program echoes a word differently, depending on the word that is passed in. Usage...
Modify code below please... Thank you!
#include
#include "process.h"
int main(void) {
string userWord; // string to store the input word bool validInput = false; //the program expects 1 word at time we need to validate that. cout
cin >> userWord; if (cin.peek() != ' ') { // cin.peek() returns the next input character without taking it out of the input stream validInput = true; } // If validInput is true that will indicate // exactly 1 string was provided by user. if (validInput == true) { processWord(userWord); } // Tell the user that something is wrong else { cout
return 0; }
This program echoes a word differently, depending on the word that is passed in. Usage: crow [word] Requirements Summary The inputted word should be echoed back to the terminal. If the word is Snow, or Corn it should be echoed as the following with a newline at the end. ./snow Corn Corn, the bird said. Corn, corn. (likewise, in the case of Snow). Command Line Arguments Your program must be capable of utilizing a command line argument to specify the input word. Your program must ensure the user has correctly provided the required command-line arguments and display a usage statement if the provided arguments are incorrect. If the word passed in does not match corn or Snow, it should just be echoed with a newline. If the input passed in is more than one word, usage statement should be printed (with a newline at the end). If no word is passed in, a usage statement should be printed with a newline at the end). The matching to Corn and Snow is case-specific, and the printout for these words should be carefully compared with that given in the Requirements Summary Modification of Existing Project Use the template provided below to bootstrap your project. Modify the main function to consider the number of parameters and print a usage statement as appropriate, rather than using cin. The other files need be modified only in order to include your name, Net ID, etc. You are permitted to resubmit any files written by the instructor, as an exception to the Code of Academic Integrity for this assignment onlyStep 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