subject

Welcome to the Personal Space Show!! I'm not sure this is the perfect place to put my C++ question, but here it is, nonetheless.

I am supposed to create a program that accepts an unknown number of integer type command line arguments, print the appropriate/corresponding statement from the argument, and print "N: Number not recognized" where N is some integer outside of 1 and 9.

This is my code so far:

/* Personal Space Show from Rick and Morty:
*
* The show is hosted by a man named Phillip Jacobs who is extremely concerned with his personal space
* and takes it very seriously. At times he's paranoid that someone is close to him, even though he is
* alone. After the intro he will direct the camera towards a projector and show slides saying "personal
* space", and telling the viewers to stay out of his personal space. At the end of the show he removes
* his own skin on live TV because he does not care to have it on his personal space.
*/

#include
#include

int main(int argc, char** argv) {

int N = atoi(*argv); //Covert type char* to type int

std::cout << "Welcome to the Personal Space Show!!" << std::endl;

for (N = 0; N < argc; N++) { //Display each command-line argument
std::cout << N << std::endl;
}

switch (N) { //Appropriate statements from Mr. Jacobs
case 1:
std::cout << "One: Personal space";
case 2:
std::cout << "Two: Personal space";
case 3:
std::cout << "Three: Stay out of my personal space";
case 4:
std::cout << "Four: Keep away from my personal space";
case 5:
std::cout << "Five: Get outta dat personal space";
case 6:
std::cout << "Six: Stay away from my personal space";
case 7:
std::cout << "Seven: Keep away from dat personal space";
case 8:
std::cout << "Eight: Personal Space";
case 9:
std::cout << "Nine: Personal space";
}

if (N < 1 || N > 9) {
std::cout << "%d: Number not recognized";
std::cout << N;
}

return 0; //Exit the program
}

Am I on the right track with parsing the command line arguments as well as printing out the correct statement? For some reason, this code keeps failing the auto grader my instructor uses.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:30
What are the steps involved in accepting all the changes in a document? arrange these in order click edit. click accept or reject. click changes. click accept all.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Alex’s family members live in different parts of the world. they would like to discuss the wedding plans of one of their distant relatives. however, alex wants all the family members to talk to each other simultaneously so that they can make decisions quickly. which mode of internet communication should they use? a. blog b. email c. wiki d. message board e. instant messaging
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Technician a says that with self-adjusting clutch systems, the release bearing constantly rotates. technician b says that the ball bearing portion of the release bearing should be lubricated with high-temperature grease during routine maintenance. which technician is correct?
Answers: 2
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
You know the right answer?
Welcome to the Personal Space Show!! I'm not sure this is the perfect place to put my C++ question,...
Questions
question
Mathematics, 18.03.2021 03:20
question
Mathematics, 18.03.2021 03:20
question
Mathematics, 18.03.2021 03:20
question
Mathematics, 18.03.2021 03:20
Questions on the website: 13722362