Computers and Technology
Computers and Technology, 05.03.2021 05:50, yurybell

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, sabrinarasull1pe6s61
Which of the following is a way the operating system prevents unknown or unauthorized users from accessing the system?
Answers: 2
image
Computers and Technology, 23.06.2019 02:30, noah2o2o
These factors limit the ability to attach files to e-mail messages. location of sender recipient's ability to open file size of file type of operating system used
Answers: 2
image
Computers and Technology, 23.06.2019 07:00, schvox
1. you have a small business that is divided into 3 departments: accounting, sales, and administration. these departments have the following number of devices (computers, printers, etc.): accounting-31, sales-28, and administration-13. using a class c private network, subnet the network so that each department will have their own subnet. you must show/explain how you arrived at your conclusion and also show the following: all available device addresses for each department, the broadcast address for each department, and the network address for each department. also, determine how many "wasted" (not usable) addresses resulted from your subnetting (enumerate them).
Answers: 3
image
Computers and Technology, 24.06.2019 01:00, kkruvc
Mastercard managers are motivated to increase (1) the number of individuals who have and use a mastercard credit card, (2) the number of banks and other clents who issue mastercards to customers and/or employees, and (3) the number of locations that accept mastercard payments. discuss how mastercard could use its data warehouse to it expand each of these customer bases.
Answers: 3
Do you know the correct answer?
Welcome to the Personal Space Show!! I'm not sure this is the perfect place to put my C++ question,...

Questions in other subjects:

Konu
Chemistry, 29.08.2019 07:10