Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Starter Code: #include #include #include #include #define ROWS 20 #define COLUMNS 30 int main(int argc, char *argv[]) { char inputs_table [ROWS][COLUMNS]; printf(Enter name age and
Starter Code:
#include#include #include #include #define ROWS 20 #define COLUMNS 30 int main(int argc, char *argv[]) { char inputs_table [ROWS][COLUMNS]; printf("Enter name age and wage: "); scanf("% % %", , , ); while (....) { ..... /* read again */ printf("Enter name age and wage: "); scanf("% % %", , , ); } printf(" records generated %s %s %s ", , , ); /* now display the input_table row by row */ ...... ...... return 0; }
5.1 Specification Write an ANSI-C program that reads user information from the standard inputs, and outputs both the original and the modified version of the records. 5.2 Implementation A file lab4E.c is for you to get started. The program should use a table-like 2-D array (i.e., an array of 'strings) to record the inputs. use loop to read inputs (from standard in), one input per line, about the user information in the form of name age wage, where age is an integer literal, and wage is a floating point literal. See sample input below store each input string into the current available 'row of the 2D array, starting from row 0 create a modified string of the input, and store it in the next row of the 2D array. In the modified version of input, all letters in name are capitalized, age becomes age10, and wage has 50% increases and is formatted with 2 digits after decimal point. Hint: for converting name to upper cases, you might need a small loop to do name [i]-touppper (name [i]) continue reading input, until a name xxx is entered. after reading all the inputs, output the 2-D array row by row, displaying each original input followed by the modified version of the input. display the current date and time and program name before generating the output, using predefined macros such as-FILE-,-TIME-. * Note that as the partial implementation shows, you should read in the three inputs in three separate variables, but you have the choice of how they are read in: they can be read in as three 'strings, like in problem D, using scanf ("%s %s %s", ), or, you can use scanf ("%s %d %f", -.) to read in the three inputs as string, int, float respectively In the next question, you will practice reading in the whole line as a string (and then 'tokenize' the string). Each approach has it pros and cons. Note that you will lose all marks if, instead of a 2D-array, you use 3 parallel 1-D arrays-one of names, one of ages, one for wages-to store and display information. 5.3 Sample Inputs/Outputs red 307 % .out Enter name, age and wage: john 60 1.0 Enter name, age and wage: eric 30 1.3 Enter name, age and wage: lisa 22 2.2 Enter name, age and wage: judy 40 3.22 Enter name, age and wage: xxx 2 2 Records generated in lab4E.c on Jan 26 2019 14:58:47 john 60 1.00 JOHN 70 1.50 eric 30 1.30 ERIC 40 1.95 lisa 22 2.2 LISA 32 3.30 judy 40 3.22 JUDY 50 4.83 red 308 % You should not hard-code the file name and date time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started