answer.
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]
2 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]2 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 converging-diverging nozzle is designed to operate with an exit Mach number of 1.75 . The nozzle is supplied from an air reser
Flura [38]

Answer:

a. 4.279 MPa

b. 3.198 MPa to 4.279 MPa

c. 0.939 MPa

d. Below 3.198 MPa

Explanation:

From the given parameters

M_{exit} = 1.75 MPa  

M at 1.6 MPa gives A_{exit}/A* = 1.2502

M at 1.8 MPa gives  A_{exit}/A* = 1.4390

Therefore, by interpolation, we have M_{exit} = 1.75 MPa  gives A

However, we shall use M_{exit} = 1.75 MPa and A

Similarly,

P_{exit}/P₀ = 0.1878

a) Where the nozzle is choked at the throat there is subsonic flow in the following diverging part of the nozzle. From tables, we have

A_{exit}/A* = 1.387. by interpolation M

Therefore P_{exit} = P₀ × P

Which shows that the nozzle is choked for back pressures lower than 4.279 MPa

b) Where there is a normal shock at the exit of the nozzle, we have;

M₁ = 1.75 MPa, P₁ = 0.1878 × 5 = 0.939 MPa

Where the normal shock is at M₁ = 1.75 MPa, P₂/P₁ = 3.406

Where the normal shock occurs at the nozzle exit, we have

P_b = 3.406\times 0.939 = 3.198 MPa

Where the shock occurs t the section prior to the nozzle exit from the throat, the back pressure was derived as P_b = 4.279 MPa

Therefore the back pressure value ranges from 3.198 MPa to 4.279 MPa

c) At M_{exit} = 1.75 MPa  and P

d) Where the back pressure is less than 3.198 MPa according to isentropic flow relations supersonic flow will exist at the exit plane    

8 0
2 years ago
A center-point bending test was performed on a 2 in. x d in. wood lumber according to ASTM D198 procedure with a span of 4 ft an
Zigmanuir [339]

Answer:

3.03 INCHES

Explanation:

According to ASTM D198 ;

Modulus of rupture = ( M / I ) * y  ----- ( 1 )

M ( bending moment ) = R * length of span / 2

                                     = (120 * 10^3 ) * 48 / 2 = 288 * 10^4 Ib-in

I ( moment of inertia ) = bd^3 / 12

                                    = ( 2 )*( d )^3  / 12 =  2d^3 / 12

b = 2 in ,  d = ?

length of span = 4 * 12 = 48 inches

R = P  / 2 =  240 * 10^3 / 2 =   120 * 10^3 Ib

y ( centroid distance ) = d / 2  inches

back to equation ( 1 )

( M / I ) * y

940.3 ksi = ( 288 * 10^4 / 2d^3 / 12 ) * d / 2

                = ( 288 * 10^4 * 12 ) / 2d^3 )  * d / 2

940300  = 34560000* d / 4d^3

4d^3 ( 940300 ) = 34560000 d  ( divide both sides with d )

4d^2 = 34560000 / 940300

d^2 = 9.188   ∴ Value of d ≈ 3.03 in

8 0
2 years ago
What properties should the head of a carpenter’s hammer possess? How would you manufacture a hammer head?
BabaBlast [244]

Properties of Carpenter's hammer possess

Explanation:

1.The head of a carpenter's hammer should possess the impact resistance, so that the chips do not peel off the striking face while working.

2.The hammer head should also be very hard, so that it does not deform while driving or eradicate any nails in wood.

3.Carpenter's hammer is used to impact smaller areas of an object.It can drive nails in the wood,can crush  the rock and shape the metal.It is not suitable for heavy work.

How hammer head is manufactured :

1.Hammer head is produced by metal forging process.

2.In this process metal is heated and this molten metal is placed in the cavities said to be dies.

3.One die is fixed and another die is movable.Ram forces the two dies under the forces which gives the metal desired shape.

4.The third process is repeated for several times.

5 0
2 years ago
When should you exercise extreme caution around power lines?
Elis [28]

<em>You should take note and exercise extreme precautions when you are near power lines and consider the following: </em>

<em> </em>

<em>1. Make sure that you have a good distance away from the lines. The minimum distance you can get is 10 feet away from the lines. Be cautious as well when you see broken lines as they could still harm you and electrified you. </em>

<em>2. Do not make ladders, equipments and things around you touch the power lines as it may harm you as well. </em>

<em>3. Clear everything and ensure that no things are near you before you lift your hands and other tools.</em>

6 0
2 years ago
A horizontal, cylindrical, tank, with hemispherical ends, is used to store liquid chlorine at 10 bar. The vessel is 4 m internal
sp2606 [1]

Answer: 0.021818m =2.18x10^-²m

Explanation: Using Laplace principle

Design pressure is =12 bar= 1200000N/m²

T = Wall thickness

Design stress=110Mn/m²= 110,000,000N/m²

Radius= diameter/2 =4/2=2m

Design stress=Hoop stress =Pr/t where p=internal pressure or internal pressure, r=radius and t= wall thickness.

As Laplace equation stated.

110,000,000= 1,2000,00 x 2/t

t= 2,400,000/110,000,000.

t= 0.021818m

t=2.18x10^-2m.

3 0
2 years ago
Other questions:
  • PDAs with two stacks are strictly more powerful than PDAs with one stack. Prove that 2-stack PDAs are not a valid model for CFLs
    12·1 answer
  • CHALLENGE ACTIVITY 2.8.1: Using constants in expressions. The cost to ship a package is a flat fee of 75 cents plus 25 cents per
    7·1 answer
  • An uninsulated, thin-walled pipe of 100-mm diameter is used to transport water to equipment that operates outdoors and uses the
    9·1 answer
  • Refrigerant-134a at 400 psia has a specific volume of 0.1384 ft3/lbm. Determine the temperature of the refrigerant based on (a)
    6·1 answer
  • Can crushers help us recycle in a space efficient way which is good for saving the earth and for giving you more room in your ap
    7·1 answer
  • A glycerin pump is powered by a 5-kW electric motor. The pressure differential between the outlet and the inlet of the pump at f
    13·1 answer
  • the ____ method is the safest turning technique to use as it does not expose your hands to the airbags deployment area
    15·1 answer
  • Technician A says that weld-through primer can be removed from the immediate weld area to improve weld quality. Technician B say
    7·1 answer
  • Determine the design angle ϕ (0∘≤ϕ≤90 ∘) between struts AB and AC so that the 400 lb horizontal force has a component of 600 lb
    10·1 answer
  • When comparing solids to fluids, the following is true: for elastic solids, the stress must be normal. For Newtonian fluids, the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!