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
Drum brakes are usually designed so that the condition of the lining can be checked even if the drum has not been
artcher [175]

Answer:

no it has to be removed

Explanation:

8 0
3 years ago
A completely reversible heat pump produces heat ata rate of 300 kW to warm a house maintained at 24°C. Theexterior air, which is
Triss [41]

Answer:

Change in entropy S = 0.061

Second law of thermodynamics is satisfied since there is an increase in entropy

Explanation:

Heat Q = 300 kW

T2 = 24°C = 297 K

T1 = 7°C = 280 K

Change in entropy =

S = Q(1/T1 - 1/T2)

= 300(1/280 - 1/297) = 0.061

There is a positive increase in entropy so the second law is satisfied.

6 0
3 years ago
Systematic searching is a skill that takes ________ to master.
bagirrra123 [75]

Answer: B, repetitive practice! hope this helps. :)

Explanation:

7 0
3 years ago
Read 2 more answers
Find Re,Rc,R1 and R2!? Show your work.(hlp plz)
Brums [2.3K]
Can u be more clear with the question plsss?
3 0
3 years ago
I’m building a pc, but I only have 2 sata cables. What are the other required cables to connect to or parts, such as the gpu?
Usimov [2.4K]

Answer:

You would also need power cables.

3 0
2 years ago
Read 2 more answers
Other questions:
  • Data becomes information when it is__________ in some way and made___________
    5·1 answer
  • Small droplets of carbon tetrachloride at 68 °F are formed with a spray nozzle. If the average diameter of the droplets is 200 u
    10·1 answer
  • Briefly describe the purpose of specifying boundary conditions.
    7·1 answer
  • 1. Looking at the case study provided under the Companion Material section, what is the main problem that is addressed in this c
    13·1 answer
  • A refrigerator has a cooling load of 50 kW. It has a COP of 2. It is run by a heat engine which consumes 50 kW of heat to supply
    12·1 answer
  • Assume that a p+ - n diode is built with an n region width l smaller than a hole diffusion length (l
    14·1 answer
  • Some General Motors flex fuel vehicles do not use a fuel sensor to measure the percentage of ethanol in the fuel. These vehicles
    5·1 answer
  • When the Moon is in the position shown, how would the Moon look to an observer on the North Pole?
    11·1 answer
  • Tech A says that wiring diagrams are essentially a map of all of the electrical components and their connections. Tech B says th
    7·1 answer
  • An interrupted line of sight means changes in ......and .... are necessary for re-establishing a ......... to the driver’s path
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!