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
Make a proposal to add a small pizza shop to a historical part of town. How could it be designed to “fit” into the area?
spin [16.1K]
It could be designed because if we had a small little pizza shop it would save our problems of going through all the trouble just for pizza
7 0
3 years ago
Read 2 more answers
Concrete ___ support and anchor the bottom of steel columns and wood post, which support beams that are pare of framing system o
dolphi86 [110]
I wanna say it’s D post support
3 0
3 years ago
Michelle is the general manager of a power plant. This morning, she will meet with city officials to discuss environmental issue
Irina-Kira [14]

Answer:

interpersonal.

Explanation:

Out of all the activities performed by Michelle, three activities involves the interpersonal skills.

1. Meeting with city officials

2. Meeting with section managers

3. Handling the complaint filed by an employee

All these activities involves interpersonal skills. Hence, we can say that she had spent her most of the day by using the interpersonal skills.

6 0
3 years ago
7. Sockets internal designs come in what sizes?
MAXImum [283]

Answer:

These drive fittings come in four common sizes: 1⁄4 inch, 3⁄8 inch, 1⁄2 inch, and 3⁄4 inch (referred to as "drives", as in "3⁄8 drive").

3 0
3 years ago
How much horse power does a Lamborghini have
statuscvo [17]
The Lamborghini SCV12 has 830 horse power.
4 0
2 years ago
Read 2 more answers
Other questions:
  • Air is compressed in a piston-cylinder device. List three examples of irreversibilities that could occur
    13·1 answer
  • A waste treatment pond is 50m long and 25m wide, and has an average depth of 2m.The density of the waste is 75.3 lbm/ft3. Calcul
    12·1 answer
  • A strong base (caustic or alkali) is added to oils to test for: b. entrained air a)- alkalinity b)- acidity c)- contamination. d
    11·1 answer
  • Tony works as a Sorter in a processing factory. Which qualifications does he most likely have?
    10·2 answers
  • PLEASE HELP ASAP!!! Thanks
    11·1 answer
  • I need this asap thank you :) plzzzzz When the spring on a mousetrap car is fully unwound, the force acting on the car is _____.
    11·1 answer
  • A positive slope on a position-time graph suggests
    15·1 answer
  • Global Convection Patterns include which of the following?
    12·1 answer
  • What can be used to measure the alcohol content in gasoline? A. Graduated cylinder B. Electronic tester C. Scan tool D. Either a
    5·1 answer
  • Explain the problems and their possible solution for electricity problems ?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!