Create an array of doubles to contain 5 values Prompt the user to enter 5 values that will be stored in the array. These values represent hours worked. Each element represents one day of work. Create 3 c-strings: full[40], first[20], last[20] Create a function parse_name(char full[], char first[], char last[]). This function will take a full name such as "Noah Zark" and separate "Noah" into the first c-string, and "Zark" into the last c-string. Create a function void create_timecard(double hours[], char first[], char last[]). This function will create (write to) a file called "timecard.txt". The file will contain the parsed first and last name, the hours, and a total of the hours. See the final file below. First Name: Noah

Answers

Answer 1

Solution :

[tex]$\#$[/tex]include [tex]$<stdio.h>$[/tex]  

[tex]$\#$[/tex]include [tex]$<string.h>$[/tex]    

void parse[tex]$\_$[/tex]name([tex]$char \ full[]$[/tex], char first[tex]$[],$[/tex] char last[tex]$[])$[/tex]

{

// to_get_this_function_working_immediately, _irst

// stub_it_out_as_below._When_you_have_everything_else

// working,_come_back_and_really_parse_full_name

// this always sets first name to "Noah"

int i, j = 0;

for(i = 0; full[i] != ' '; i++)

  first[j++] = full[i];

first[j] = '\0';  

// this always sets last name to "Zark"

j = 0;

strcpy(last, full+i+1);

// replace the above calls with the actual logic to separate

// full into two distinct pieces

}

int main()

{

char full[40], first[20], last[20];

double hours[5];

// ask the user to enter full name

printf("What is your name? ");

gets(full);

// parse the full name into first and last

parse_name(full, first, last);

// load the hours

for(int i = 0; i < 5; i++)

{

   printf("Enter hours for day %d: ", i+1);

   scanf("%lf", &hours[i]);

}

// create the time card

FILE* fp = fopen("timecard.txt", "w");

fprintf(fp, "First Name: %s\n", first);

fprintf(fp, "Last Name: %s\n", last);

double sum = 0.0;

for(int i = 0; i < 5; i++)

{

   fprintf(fp, "Day %i: %.1lf\n", i+1, hours[i]);

   sum += hours[i];

}

fprintf(fp, "Total: %.1f\n", sum);    

printf("Timecard is ready. See timecard.txt\n");

return 0;

}


Related Questions

Which functions do you use to complete Step 3e? Check all that apply.

Animations tab
Animation styles
Design
Lines
Motion Paths
Reordering of animations

Answers

Answer: Animations tab

Animation styles

Lines

Motion paths

Explanation: Edg2021

importance of information
literay to the society

Answers

Explanation:

Information literacy is important for today's learners, it promotes problem solving approaches and thinking skills – asking questions and seeking answers, finding information, forming opinions, evaluateing sources, and making decisions fostering successful learners, effective contributors, and confident individuals.

what does the
command do

Answers

Please specify your question.

What may make it easy for cybercriminals to commit cybercrimes? Select 2 options.

Cybercrimes are not classified as real crimes, only as virtual crimes.

They operate from countries that do not have strict laws against cybercrime.

They are not physically present when the crime is committed.

The United States has no law enforcement that acts against them.

Law enforcement agencies lack the expertise to investigate them.

Answers

Answer: They operate from countries that do not have strict laws against cybercrime.

They are not physically present when the crime is committed.

Explanation:

edg

Answer:

They operate from countries that do not have strict laws against cybercrime.

They are not physically present when the crime is committed.

Explanation:

Other Questions
Can someone help me with this please ASAP !!!!!!!! The isotope Herodium-100 decreases by half every minute, Herodium-100 is there isotope that gives a super hero their strength. Once the amount depletes to 4 ml, asuperhero becomes tired and need to leave the fight. If Mathman has 2000mL in hisbody, when will he have to rest and replenish, rounded to the nearest minute? What jobs were Egyptianwomen allowed to hold? What jobswere they not allowed to hold? Question 7 (5 points)(06.04 LC)The equation of the line of best fit of a scatter plot is y = 8x - 1. What is the slope ofthe equation? (5 points)1)-82-13) 14) 8 "...watched as truck after truck, filled with men wearing fatigues, roared past me."A. hyperboleB. personificationC. OnomatopoeiaD. Idiom carry out the following divisions. In the Haber reaction shown below, _______?is thelimiting reactant if equal moles of each reactant are used.3H2 + N2 -> 2NH3 Hi I need help please HELP ASAP!!!!! Plss sill give u Brainly and heart Cross out the 2 plural nouns in the sentence below. Then rewrite the sentence using the correct form of the plural noun. Some animals, such as fishes, whales, and sea snakes, spend their entire lifes in water Does anyone know how kinetic energy and crater diameter are related?? main idea of amendments 11-27 Please please help me!!! High Country, Inc., produces and sells many recreational products. The company has just opened a new plant to produce a folding camp cot that will be marketed throughout the United States. The following cost and revenue data relate to May, the first month of the plants operation: Beginning inventory 0 Units produced 47,000 Units sold 42,000 Selling price per unit $ 84 Selling and administrative expenses: Variable per unit $ 4 Fixed (per month) $ 560,000 Manufacturing costs: Direct materials cost per unit $ 17 Direct labor cost per unit $ 7 Variable manufacturing overhead cost per unit $ 3 Fixed manufacturing overhead cost (per month) $ 893,000 Management is anxious to assess the profitability of the new camp cot during the month of May. Required: 1. Assume that the company uses absorption costing. a. Calculate the unit product cost. b. Prepare an income statement for May. 2. Assume that the company uses variable costing. a. Calculate the unit product cost. b. Prepare a contribution format income statement for May. 4x + 7 = ? (I'm not so good in math so please help) The sum of three consecutive even integers is 30 more than the largest I need help with this pls help The question is in the graph. Please help. Pleaseee help! HELP NEEDED ASAP! I'm confused, I'm used to doing these problems with both coordinates :/