Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Starter Code: #include #define SIZE 10 #define SIZE2 40 int main(int argc, char *argv[]) { char name[SIZE], wage[SIZE], age[SIZE]; char resu[SIZE2], resu2[SIZE2], resu3[SIZE2]; printf(Enter name,

image text in transcribedimage text in transcribedStarter Code:

#include

#define SIZE 10 #define SIZE2 40

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

char name[SIZE], wage[SIZE], age[SIZE]; char resu[SIZE2], resu2[SIZE2], resu3[SIZE2]; printf("Enter name, age and wage (xxx to quit): "); scanf("%s %s %s", name, age, wage); while () {

/* use scanf to read again */ } return 0; }

4.1 Specification Develop an ANSI-C program that reads user information from the standard inputs, and outputs the modified version of the records. 4.2 Implementation Download file lab4D.c and start from there. Note that the program uses loop to read inputs (from standard in), one input per line, about the user information in the form of name age wage, where name is a word (with no space), age is an integer literal, and wage is a floating point literal. See sample input below uses scanf ("%s where name, age and wage are of type char[20] . %s %s", wage) to read in three input 'strings", . name, age, The program should, after reading each line of inputs, creates a char [40] string resu for the modified version of the input. In the modified version of input, the first letter of name is capitalized, age becomes age + 10, and wage has 100% increases with 3 digits after decimal point followed by the floor and ceiling of the increase wage. The values are separated by dashes and brackets as shown below Hint: 1) to convert to a float with 3 digits after decimal point, review the code of runningAveLocal.c provided in lab3. 2) To create resu from several variables, consider sprintf. 3) if you use math library functions, be aware that the return type is double. then duplicate/copy resu to resu2 using a library function declared in (how * . about strcpy or strcat) then duplicate/copy resu to resu3 using a library function declared in (how about sprintf?) then output the resulting strings resu, resu2 and resu3. e continue reading input, until a name xxx is entered (followed by any two words) 4.3 Sample Inputs/Outputs: red 118 % .out Enter name, age and wage (xxx to quit): sue 22 33.3 Sue-32-66.600- [66, 67] Sue-32-66.600 [66, 67] Sue-32-66.600- [66, 67] Enter name, age and wage (xxx to quit): john 60 1.0 John-70-2.000-[2,2] John-70-2.000- [2,2] John-70-2.000-[2,2] Enter name, age and wage (xxx to quit): lisa 30 1.34 Lisa-40-2.680- [2,3] Lisa-40-2.680-[2,3] Lisa-40-2.680-[2,3] Enter name, age and wage (xxx to quit) : judy 40 3.'2 Judy-50-6.400-[6,7] Judy-50-6.400-[6,7] Judy-50-6.400-[6,7] Enter name, age and wage (xxx to quit) : xxx 2 2 red 119 %

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions