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
A piston-cylinder apparatus has a piston of mass 2kg and diameterof
iragen [17]

Answer:

M =2.33 kg

Explanation:

given data:

mass of piston - 2kg

diameter of piston is 10 cm

height of water 30 cm

atmospheric pressure 101 kPa

water temperature = 50°C

Density of water at 50 degree celcius is 988kg/m^3

volume of cylinder is  V = A \times h

                                       = \pi r^2 \times h

                                       = \pi 0.05^2\times 0.3

mass of available in the given container is

M = V\times d

  = volume \times density

= \pi 0.05^2\times 0.3 \times 988

M =2.33 kg

6 0
3 years ago
When your fixing a car, what is the first thing you want to do?
Shtirlitz [24]

Answer:

Changing oil.

Explanation:

You need to regularly check and change your car’s oil to ensure smooth running of the vehicle and to prolong the lifespan of its engine.

6 0
2 years ago
Five kilograms of air at 427°C and 600 kPa are contained in a piston–cylinder device. The air expands adiabatically until the pr
son4ous [18]

Answer:

The entropy change of the air is 0.240kJ/kgK

Explanation:

T_{1} =427+273K,T_{1} =700K\\P_{1} =600kPa\\P_{2} =100kPa

T_{2}  is unknown

we can apply the following expression to find T_{2}

-w_{out} =mc_{v} (T_{2} -T_{1} )

T_{2} =T_{1} -\frac{w_{out } }{mc_{v} }

now substitute

T_{2} =700K-\frac{600kJ}{5kg*0.718kJ/kgK} \\T_{2}=533K

To find entropy change of the air we can apply the ideal gas relationship

Δs_{air}=c_{p} ln\frac{T_{2} }{T_{1} } -Rln\frac{P_{2} }{P_{1} }

Δs_{air} =1.005*ln(\frac{533}{700})-0.287* in(\frac{100}{600} )

Δs_{air} =0.240kJ/kgK

4 0
3 years ago
Please help me bro come on
melomori [17]
Answer:

12

Explanation:

5 • 3 = 15
3 • 3 = 9
4 • 3 = 12
6 0
3 years ago
Read 2 more answers
What is this thing on my boat?
MaRussiya [10]
It may be an engine cooler, or it may be for the boats speed

But I think it is for cooling the engine down
5 0
2 years ago
Other questions:
  • The wheel and the attached reel have a combined weight of 50lb and a radius of gyration about their center of 6 A k in = . If pu
    9·1 answer
  • Two technicians are discussing solder wire repair. Technician A says that electrical tape can be used to cover the joint. Techni
    10·1 answer
  • WANT POINTS? JUST ANSWER ME:)
    6·2 answers
  • What kind of value should an employee possess when employees are expected to be responsible and fair?
    5·1 answer
  • A rectangular open channel is 20 ft wide and has a bed slope of 0.007. Manning's roughness coefficient n is 0.03. It is in unifo
    10·1 answer
  • A heat pump with refrigerant-134a as the working fluid is used to keep a space at 25°C by absorbing heat from geothermal water t
    8·1 answer
  • QUESTION:
    13·1 answer
  • In the long run, if the firm decides to keep output at its initial level, what will it likely do? Stay on SRATC3 but decrease to
    15·1 answer
  • Workers who work with what kind of chemicals chemicals may require regular medical checkups on a more frequent basis as a result
    15·1 answer
  • Describe the risks associated with their working environment (such as the tools, materials and equipment that they use, spillage
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!