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
vichka [17]
3 years ago
9

Convert the following C program to C++.

Computers and Technology
1 answer:
ki77a [65]3 years ago
8 0

Answer:

The program equivalent in C++ is:

<em>#include <cstdio></em>

<em>#include <cstdlib></em>

#define SIZE 5

using namespace std;

<em>int main(int argc, char *argv[]) {</em>

<em>int numerator = 25;</em>

<em>int denominator = 10;</em>

<em>FILE * inPut = fopen(argv[1], "r");</em>

<em>FILE * outPut = fopen(argv[2], "w");</em>

<em>float result = (float)numerator/denominator;</em>

<em>fprintf(outPut,"Result is %.2f\n", result);</em>

<em>float arr[SIZE];</em>

<em>for(int i = 0; i < SIZE; i++) {</em>

<em>fscanf(inPut, "%f", &arr[i]);</em>

<em>fprintf(outPut, "%7.4f\n", arr[i]);</em>

<em>}</em>

<em>return 0;</em>

<em>}</em>

Explanation:

See attachment for explanation.

Each line were numbered with equivalent line number in the C program

Download cpp
You might be interested in
ASSIGNMENT FORM 2 1. Evaluate the following without using mathematical tables 0.36 x 6(142 +58) 21.44 - 10.64​
liq [111]
9251.44 or 231286/25 or 9251(11/25)

0.36*6*200*21.44-10.64
becomes
9262.08-10.64
gives you the result
8 0
2 years ago
give one word • pressure exerted by a stationary liquid _______. • force in a direction perpendicular to a given surface area __
mel-nik [20]

Answer:

1. Hydrostatic pressure.

2. Pressure.

3. Equilibrium forces.

Explanation:

1. <u>Hydrostatic pressure</u>: pressure exerted by a stationary liquid. It is simply the pressure in a liquid such as water at a specific depth.

Mathematically, hydrostatic pressure is given by the formula;

H.P = rho * g * d

Where:

  • H.P is the hydrostatic pressure of a liquid.
  • rho represents the density of a liquid.
  • g is the acceleration due to gravity.
  • d is the depth (height) of a liquid.

2. <u>Pressure</u>: it is the force in a direction perpendicular to a given surface area. Thus, it's typically measured in Newton per meters (N/m²).

Mathematically, pressure is given by the formula;

Pressure = \frac {Force}{area}

3. <u>Equilibrium forces</u>: a pair of forces whose resultant is zero. It is also referred to as balanced forces because the resultant of all the pair of forces acting on a body or system is at equilibrium (balanced).

6 0
3 years ago
How do I center images in HTML. Also I need to have one image lay over another. How do I do this in HTML?
11111nata11111 [884]
HTML isn't really used for this anymore, it's  done via CSS (Cascading Style Sheets). On the web currently, HTML pretty much just describes what to be displayed, CSS describes how it's to be displayed and JavaScript is used to provide function to a web page.

In HTML, you could use: align="center" as an attribute of the img tag to center it. Now it's preferable to use text-align: center CSS for the object containing the image (a div or p).

Positioning things on top of each other brings in z-axis and position CSS. Check out the CSS tutorial at http://www.w3schools.com . It's free.
5 0
3 years ago
Dante went to change the date for an appointment in his Outlook calendar. He double-clicked in the appointment and made the chan
meriva

The correct answer is that Dante did not click the Save and Close button before exiting the appointment.

When you make a change to an appointment in the Outlook calendar you need to click on Save in order to have the change saved in your calendar. If you do not do this the appointment will revert back to the original time and date when you exit the program.

3 0
3 years ago
K
ollegr [7]
True??????????????????????????
7 0
3 years ago
Read 2 more answers
Other questions:
  • Two electronics students are discussing static electricity and electric current. Student A says that a basic property of static
    12·1 answer
  • Prompt the user for an automobile service. Each service type is composed of two strings. Output the user's input. (1 pt) Ex: Ent
    9·1 answer
  • How does a hard drive work?
    5·1 answer
  • How many people employed in the United States work in a job related to digital media?
    12·1 answer
  • The___provides access to the internet; may also be internal
    11·1 answer
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • May someone type this down below just like how it is shown in the picture.
    7·1 answer
  • It is possible to make the document larger for viewing small text.<br><br> True<br> False
    15·2 answers
  • Wyatt has a database to keep track of his enormous collection of videos. How can Wyatt find the details for the game Lost on Mar
    11·2 answers
  • What are the main security weaknesses of coaxial cable, twisted pair cable, and fiber optic cable? How might the router itself b
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!