Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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...

image text in transcribed

image text in transcribed

Modify code below please... Thank you!

#include #include using namespace std;

#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 only

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

Students also viewed these Databases questions

Question

Verify the statement made in the remark following Example 10.2.

Answered: 1 week ago

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago