1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aksik [14]
3 years ago
15

Open the"stateData3.c" program and try to understand how the tokenization works. If you open the input file "stateData.txt", you

can clearly seethat a comma separates the state name and its population. The tokenizer portion of the programs separates each line into two tokens and stores them into two different arrays. You need to display the arrayelements such that each line has a state and itspopulation. Also calculate the total population of USA.Then,examine the portion of the code how it writes the array elements into a binary datafile.You need to write similar logic where it writes the array elements into a text file "stateDataOutput2.txt". Please check the syntax and usage of fprintf(); and use that here.
Engineering
1 answer:
babymother [125]3 years ago
5 0

Answer:

Kindly see explaination

Explanation:

Code

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#define size 200

int main(void)

{

int const numStates = 50;

char tempBuffer[size];

char tmp[size];

char fileName[] = "stateData.txt"; // Name of the text file (input file) which contains states and its populations

char outFile[] = "stateDataOutput1.txt"; // Output file name

// Open the input file, quit if it fails...

FILE *instream = fopen(fileName, "r");

/* Output File variable */

FILE *opstream;

if(instream == NULL) {

fprintf(stderr, "Unable to open file: %s\n", fileName);

exit(1);

}

//TODO: Open the output file in write ("w") mode

/* Opening output file in write mode */

opstream = fopen(outFile, "w");

//TODO: Read the file, line by line and write each line into the output file

//Reading data from file

while(fgets(tmp, size, instream) != NULL)

{

//Writing data to file

fputs(tmp, opstream);

}

// Close the input file

fclose(instream);

//TODO: Close the output file

/* Closing output file */

fclose(opstream);

return 0;

}

You might be interested in
Application 1: Consider the following beam under combined loading of a distributed pressure and applied bending moment. Complete
Ivan

Answer:

Explanation:

kindly check he attached file below

7 0
4 years ago
A tension member must be designed for a service dead load of 18 kips and a service live load of 2 kips.
ella [17]

Answer:

A) max factored load ( pv = 1.4 * 18 ) = 25.2 kips

B) max load factored load  = ( Pa = 18 + 2 ) = 20 kips

Explanation:

service dead load = 18 kips

service live load = 2 kips

A) Determine the maximum factored load and controlling AISC load combination

max factored load ( pv = 1.4 * 18 ) = 25.2 kips

DL = 18 kips

LL = 2 kips

B) Determine the max load and controlling AISC load combination

max load factored load  = ( Pa = 18 + 2 ) = 20 kips

attached below

4 0
3 years ago
Consider the four – bar mechanism in Fig. 1 with a velocity VA= 9.14 m/s, determine :
alexira [117]

Answer:

?????????????????????????????????

7 0
3 years ago
What is the basic definition of design?
torisob [31]

A design is a plan or specification for the construction of an object or system or for the implementation of an activity or process, or the result of that plan or specification in the form of a prototype, product or process. The verb to design expresses the process of developing a design.

8 0
4 years ago
An aggregate blend consists of 65% of aggregate A and 35% of aggregate B. The bulk specific gravities of aggregate A and B are 2
lozanna [386]

Answer:

2.68

Explanation:

Percentage by Mass of each Aggregate :

Pa = 65% ; Pb = 35%;

Bulk Specific gravity of each aggregate :

Ga = 2.45 ; Gb = 3.25

Gsb = (Pa + Pb) / (Pa/Ga + Pb/Gb)

Gsb = (65 + 35) / (65/2.45 + 35/3.25)

Gsb = (65 + 35) / 37.299843

Gsb = 100 / 37.299843

Gsb = 2.68

8 0
3 years ago
Other questions:
  • Briefly explain what are the following AIDC technologies for industry automation:
    11·1 answer
  • Suppose you have two boxes in front of you. One box contains a Thevenin Equivalent (voltage source in series with a resistor) an
    13·1 answer
  • Yfchggfcvkuhgvjbjhbsdfhjkibgihdfgb
    6·1 answer
  • How does the turbo on a car work?
    5·2 answers
  • I don’t understand this question , help? thanks.
    14·1 answer
  • Three spheres are subjected to a hydraulic stress. The pressure on spheres 1 and 2 is the same, and they are made of the same ma
    8·1 answer
  • How can any student outside apply for studying engineering at Cambridge University​
    7·1 answer
  • Which of the following explains why truck drivers are required to take a rest period after a certain period of driving?
    8·2 answers
  • If you are working with an extension ladder that has 15 rungs in each of the two sliding sections, this
    12·1 answer
  • The high-pressure fuel pumps used in gasoline direct-injection (GDI) systems are powered by ________.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!