[Solved]Lab 11 Command Line Arguments Lab Goals Goals Lab 1 Get Students Familiar Command Line Arg Q37220048
Code in C
Lab 11: Command Line Arguments Lab Goals The goals of this lab are to 1 Get students familiar with command line arguments 1. Formatting: Make sure that you follow the precise recommendations of the output content and formatting: for example, do not change the text in the first problem from “Enter an integer: to “Enter nunber: “. Your assignment will be auto-graded and any changes in formatting will result in a loss in the grade. 2. Comments: Header comments are required on all files and recommended for the rest of the program. 3. Restriction: The use of goto statements anywhere within this program is prohibited. Points will be 4. Formatting: Your program must be formatted correctly. This means: Points will be deducted if no header comments are included. deducted if goto is used. Everythi The order in your .c file must be: #includes. #defines, function prototypes, main function, function definitions ing in your program must be indented properly a. b. Problem 1 Save your program as cna.c Write a program which accepts command line arguments and asks the user to enter an integer n. The program should then print out all the command line arguments that have at least n characters. The program should function as follows (items underlined are to be entered by the user): gcc cna.c o check args /check args one two three twentytwo Enter an integer: 4 three has at least 4 characters twentytwo has at least 4 characters Program Design 1. Make sure that you use the proper argument list for your main function, to be able to read command line arguments 2. Prompt the user and read in the value of n. 3. Set up a for loop that scans through the command line arguments. In the loop your program should: Check the length of each command line argument using strlen. Don’t forget to include the string library If the string has at least n characters print it out as shown above. 1. 2. Show transcribed image text Lab 11: Command Line Arguments Lab Goals The goals of this lab are to 1 Get students familiar with command line arguments 1. Formatting: Make sure that you follow the precise recommendations of the output content and formatting: for example, do not change the text in the first problem from “Enter an integer: to “Enter nunber: “. Your assignment will be auto-graded and any changes in formatting will result in a loss in the grade. 2. Comments: Header comments are required on all files and recommended for the rest of the program. 3. Restriction: The use of goto statements anywhere within this program is prohibited. Points will be 4. Formatting: Your program must be formatted correctly. This means: Points will be deducted if no header comments are included. deducted if goto is used. Everythi The order in your .c file must be: #includes. #defines, function prototypes, main function, function definitions ing in your program must be indented properly a. b. Problem 1 Save your program as cna.c Write a program which accepts command line arguments and asks the user to enter an integer n. The program should then print out all the command line arguments that have at least n characters. The program should function as follows (items underlined are to be entered by the user): gcc cna.c o check args /check args one two three twentytwo Enter an integer: 4 three has at least 4 characters twentytwo has at least 4 characters Program Design 1. Make sure that you use the proper argument list for your main function, to be able to read command line arguments 2. Prompt the user and read in the value of n. 3. Set up a for loop that scans through the command line arguments. In the loop your program should: Check the length of each command line argument using strlen. Don’t forget to include the string library If the string has at least n characters print it out as shown above. 1. 2.
Expert Answer
Answer to Lab 11: Command Line Arguments Lab Goals The goals of this lab are to 1 Get students familiar with command line argument… . . .
OR

