/********************************************************************** *Program
ID: 655264 • Letter: #
Question
/**********************************************************************
*Program Name :
*Author :
*Due Date : April 11, 2011
*Course/Section :
*Program Description: Write a program to input an unknown number of
* values into an empty array. It is important that the array
* not have any values in it that you want saved prior to
* implementing this code
*
*BEGIN Array Input Using Sentinel Value
* Set Count = 0
* Input first value or quit value
* WHILE (User did not enter the quit value)
* Store the input in the array at position Count
* Increment Count by 1
* IF (the array has been filled)
* Output message indicating max inputs have been reached
* Set the Input variable to the quit value
* ELSE //the array has not been filled
* Prompt the user for next input value or quit value
* END IF
* END WHILE
* Clear Screen
* Display Heading
* FOR (Each value in the array)
* Display value on its own line
* END FOR
*END Lab01 - Array Input Using Sentinel Value *********************************************************************/ public class ArrayInsert
{ public static void main(String [] args)
{
//local constants
//local variables
/**************************start main program*********************/
//show students how to go from pseudocode to code }
//end main program
Explanation / Answer
#include main(int argc, char** argv) { int i; printf("argc = %dn", argc); for (i = 0; i < argc; i++) printf("argv[%d] = "%s"n", i, argv[i]); printf("n"); // form of input // prog fname -a val1 val2 val3 val4 // or // prog -a val1 val2 val3 val4 fname // // also -b flag can be called and it can be placed anywhere return(0); }
Connected grey cells form a
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.