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
Technician A says that a fully charged battery is less likely to freeze than a discharged battery. Technician B says that the st
zheka24 [161]
Answer : Technician B is correct
8 0
3 years ago
Which of the following is true about modern hydraulic lifts?
kaheart [24]

The modern hydraulic lifts make use of biodegradable fluid to transmit hydraulic power

<em>Question: The options are left out in the question. The details and facts about the modern hydraulic lift are presented here</em>

<em />

Details about the modern hydraulic lifts include;

The development of the  modern hydraulic occurred in the Industrial Revolution to perform task done previously by steam powered elevators  

The power of the hydraulic lift come from the hydraulic cylinder known as the actuator, which in turn is powered by pressurized hydraulic fluid such as oil

The hydraulic fluid is pushed by a piston rod through which energy is capable of being transferred, such that the applied force is multiplied, to provide more power for lifting

<u>Facts about the modern hydraulic lifts include;</u>

  • The dry motor in the modern hydraulic lift is more efficient and consumes 20% less energy
  • It comprises of valves that are controlled electronically such that the response is much rapid and the energy consumption is reduced by a further 20%
  • The cars used in the modern lift are lighter, as well as the slings, which reduces the power usage by 20%
  • It makes use of chemicals which are environmentally friendly as hydraulic fluid
  • The flash point of the fluid used is higher, as well as it posses 50% lower compressibility as well elasticity

Learn more here:

brainly.com/question/16942803

6 0
2 years ago
tech A says that a Hall-effect sensor can be used in an electronic ignition system. Tech B says that an optical-type sensor can
Alex

Answer:

<em>Both Tech A and Tech B are correct.</em>

<em>Explanation:</em>

<em>The Hall effect sen sensor are used to control displacements and rotations of various body components  of the vehicles, engine vibrations , and the ignition   system</em>

<em>The  optical-type sensor converts rays of light  into electronic signals. It measures the quantity physically of which the translates to a form that is understandable or readable  by an instrument. An optical sensor is larger part of a  system that integrates light sources, a device for measuring  and the optical sensor, which therefore is usually  connected to an electrical trigger.</em>

6 0
3 years ago
__________ affect(s) the amount of air conditioning required.
Grace [21]

Answer:

Option D

All the above

Explanation:

Depending with the number of occupants in a building, the number of air conditioners required can either be increased or reduced. For instance, if the building is to be a classroom of over 50 students, 1 air-conditioner can't serve effectively. Similarly, the activity of occupants also dictate the amount of air conditioners required since if it's a gym room where occupants exercise often then the air conditioners required is different from if the room was to serve as a  lounge. The appliances that also operate in a room require that air conditioners be installed as per the heat that may be generated by the appliances.

5 0
3 years ago
(c) As Engineering and Computing students, you must be familiar, with the respective professional bodies, as well as, Rules of P
guajiro [1.7K]

The professional ethics for computer engineers are:

  • They will Contribute to society and to human well-being.
  • They will  Avoid harm.
  • Be honest and trustworthy.
  • They will be fair and take action that do to discriminate others.

<h3>What are the Characteristics of Code of Ethics?</h3>

The code of ethics are known to be a kind of a universal moral values, that is one that state that what a person expect of any given employee such as been trustworthy, respectful, responsible, and others.

Note that Rules of Practice, Professional Obligations and Codes of Ethics. are known to be put in place to avoid issues that may lead to conflict.

Therefore, i believe that  As Engineering and Computing students, the respective professional bodies, Rules of Practice, Professional Obligations and Codes of Ethics are good and acts as a check and balance to us.

Therefore, The professional ethics for computer engineers are:

  • They will Contribute to society and to human well-being.
  • They will  Avoid harm.
  • Be honest and trustworthy.
  • They will be fair and take action that do to discriminate others.

Learn more about Engineering rules from

brainly.com/question/17169621

#SPJ1

4 0
2 years ago
Other questions:
  • You have designed a treatment system for contaminant Z. The treatment system consists of a pipe that feeds into a CSTR. The pipe
    8·1 answer
  • Someone please help me with this I’m stuck on it ?!i don’t have a lot of time
    12·1 answer
  • A cartridge electrical heater is shaped as a cylinder of length L=200mm and outer diameter D=20 mm. Under normal operating condi
    5·1 answer
  • What's the best way to plan an organized​
    7·1 answer
  • Engine blocks are made by using a manufacturing process called​
    12·1 answer
  • We are given a CSP with only binary constraints. Assume we run backtracking search with arc consistency as follows. Initially, w
    8·1 answer
  • Design for human-fit strategies include:
    12·1 answer
  • Hi I'm trying to build a desk that moves up and down electrically but i need help
    9·1 answer
  • Although studs are sometimes spaced 24" O.C. in residential structures, a spacing of_____ O.C. is more commonly used.
    5·1 answer
  • Technician A says the compressor is the dividing line of the refrigeration system, low- to high-side. Technician B says the expa
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!