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
What laws are broken when you hack someone?
postnew [5]

Answer:

it depends

Explanation:

if you are hacking for a purpose that is benefiting the person being hacked, that is ethical hacking. ethical hacking is not illegal, as long as you get permission from the person being hacked.

if you hack someone without their knowledge, that is unethical hacking, and that is in many cases, a crime, and if it has enough of a detrimental effect on a companys process, it could land you into prison and earn you a hefty fine.

ethical hacking is good for testing a networks security, and if all is well, the ethical hacker shouldnt be able to get into a network if it is secured properly.

6 0
2 years ago
The physical parts or components of a computer system is called what
mylen [45]

Here is your answer:


The physical parts or components of a computer system is called "computer hardware." Computer hardware is what stores most of your computers applications that help it run more fluently for example the computers speakers are part of it's hardware since how it's used to help the person hear the computer and it helps the computer run smoothly.


Hope this helps!


<em>~Nonportrit</em>

4 0
2 years ago
Right now I have an i5 2400 and a PYN XLR8 gaming GTX 1650 Super, my CPU is too weak for 1080p gaming, what CPU should I get tha
Dmitry_Shevchenko [17]

Answer:

if its a number you need 5600GHz but im not to sure

Explanation:

8 0
2 years ago
Read 2 more answers
A programmer wants to write a procedure that calculates the net elevation - total number of feet a traveler goes up and down. Fo
ch4aika [34]

Answer:

Pseudocode

////////////////////////////////////////////////////////////////////////////////////////////////////////////

Integer netElevation(list of elements of type elevation - type and number)

<em>function open</em>

   Define running total = 0

   for each element from list

   <em>loop open</em>

       elevation type = element[i].type

      if (elevation type == Up)

           running total = running total + element[i].number

       else

           running total = running total - element[i].number

   <em>loop close</em>

   return running total

<em>function close</em>

3 0
3 years ago
an early type of GUI is created, which includes windows, pop-ups, icons, and menus. What year did this happen? Please help!!! qu
Dahasolnce [82]

Answer:

1979

Sources:

Wired

InventHelp

hope i helped :D

3 0
3 years ago
Other questions:
  • By issuing concert tickets on the blockchain, fans can verify transfer of ownership from one digital wallet to another, rather t
    14·1 answer
  • 6. Sandra did a survey to see how
    9·1 answer
  • How does a firewall provide network security
    8·1 answer
  • _______ is the remote performance of medical exams, consultations, health monitoring and analysis using special medical equipmen
    15·1 answer
  • A(n) ____________ specifies a variable's name and data type.
    5·2 answers
  • A technician mistakenly uninstalled an application that is crucial for the productivity of the user.
    6·1 answer
  • How is the internet made?
    7·1 answer
  • Number Array Class
    5·1 answer
  • Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio
    15·1 answer
  • Could u give me brief summary of New Years
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!