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
The beginning statement of a loop is called a declaration.<br> True<br> False
Ilya [14]
It is true the reason why it is true is
4 0
2 years ago
Read 2 more answers
The ability for a protocol or program to determine that something went wrong is known as_________.
777dan777 [17]

Answer:

The correct answer to the following question will be Error-detection.

Explanation:

Error-detection: The detection of errors caused during the transmission from the transmitter to the receiver by damage and other noises, known as Error-detection. This error-detection has the ability to resolute if something went wrong and if any error occurs in the program.

There are mainly three types of error-detection, these types can be followed:

  • Automatic Repeat Request (ARQ)
  • Forward Error Correction
  • Hybrid Schemes

There are two methods for error-detection, such as:

  • Single parity check
  • Two-dimensional parity check

4 0
3 years ago
Jill edited James's document using Track Changes. James agrees with all of the edits and wants to incorporate them into his text
OLga [1]
   Hey friends

The answer would be B

              ~Katie

8 0
3 years ago
Read 2 more answers
Write a function transpose(matrix) that returns the transpose of the input matrix, which is represented as a list of lists. Reca
mariarad [96]

Answer:you eat

Explanation:yea

4 0
2 years ago
The internet has provided great opportunities for fundraising. true/false
alekssr [168]
True, sites such as kickstarter and just giving are fantastic examples of such.
8 0
3 years ago
Other questions:
  • Which is the highest level of the hierarchy of needs model?
    7·2 answers
  • Which f the following is not a characteristic of igneous rock
    8·1 answer
  • You would like to know how many cells contain data. Which function should you use?
    11·1 answer
  • How are computers used in producing weather forecasts?
    8·1 answer
  • Which of the following statements about the break statement is false? Group of answer choices Common uses of the break statement
    12·1 answer
  • The camera still is bad even with the new iPhone xr and especially in low light it is even worst because you can see the pixels
    15·1 answer
  • Write the Q basic program to find the area of room.​
    10·1 answer
  • What is the CPU's role?
    15·2 answers
  • What is the base of a number system?
    8·1 answer
  • Define the term hardwar<br><br>​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!