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
4. The instant the ignition switch is turned to the start position,
geniusboy [140]

Answer:

D. Both pull-in and hold-in windings are energized.

Explanation:

The instant the ignition switch is turned to the start position, "Both pull-in and hold-in windings are energized." This is because the moment the ignition switch is turned to the start position, voltage passes through to the S terminal of the solenoid.

The hold-in winding is attached to the case of the solenoid. Similarly, the pull-in winding is also attached to the starter motor. Thereby, the current will move across both windings by getting energized to generate a strong magnetic field.

4 0
3 years ago
What are the height and width of scissors?
timofeeve [1]
Short ones are 4.5 inches but long ones can be up to 8 inches.
8 0
3 years ago
The role of civil and structural engineer is to produce buildings for
Alinara [238K]
So I’m thinking C because they both have a lot to do with design here is my evidence. Structural engineering is a component of civil engineering which focuses on the design and development of infrastructures such as bridges, skyscrapers, dams. Civil engineering is a professional engineering discipline that deals with the design, construction, and maintenance of the physical and naturally built environment. I may be wrong but hope this helped!
3 0
3 years ago
What are the conditions for sheet generator to build up its voltage?
MA_775_DIABLO [31]

Answer:

There are six conditions

1. Poles should contain some residual flux.

2. Field and armature winding must be correctly connected so that initial mmm adds residual flux.

3. Resistance of field winding must be less than critical resistance.

4. Speed of prime mover of generator must be above critical speed.

5. Generator must be on load.

6. Brushes must have proper contact with commutators.

Explanation:

3 0
3 years ago
A task is something that you can physically do.
Jet001 [13]
The answer is T because a task is getting something done
5 0
3 years ago
Read 2 more answers
Other questions:
  • The manufacturer of a 1.5 V D flashlight battery says that the battery will deliver 9 {\rm mA} for 37 continuous hours. During t
    10·1 answer
  • One type of illumination system consists of rows of strip fluorescents and a ceiling that will transmit light. For this system t
    15·1 answer
  • A ceramic material can be defined as an organic compound consisting of a metal or semimetal and one or more nonmetals: (a) true
    9·1 answer
  • In part A you are asked to write the pseudocode for the program. In part B you are asked to write the syntax of the code for the
    11·1 answer
  • The E7018 Electrode produces a/an
    9·1 answer
  • The<br> _______includes classes of laborers, such as general laborer, apprentice laborer and mason.
    9·1 answer
  • Water enters an ice machine at 55°F and leaves as ice at 25°F. If the COP of the ice machine is 2.45 during this operation, dete
    7·1 answer
  • Vital role of maritime english among seaferers
    13·1 answer
  • 3.
    7·1 answer
  • What is another term for the notes that a reader can add to text in a word-processing document?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!