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
Match the component to its function. resistor inductor capacitor battery transistor This component stores a temporary charge. ar
OlgaM077 [116]

Answer:

1. Capacitor.

2. Inductor.

3. Resistor.

4. Battery.

5. Transistor.

Explanation:

1. <u>Capacitor</u>: this component stores a temporary charge.  

2. <u>Inductor</u>: this component stores electric energy in the form of a magnetic field.

3. <u>Resistor</u>: this component prevents components from overheating.

4. <u>Battery</u>: this component produces electricity by converting chemical energy into electric energy.

5. <u>Transistor</u>: the voltage applied to the base can control the current that flows across the emitter and collector.

6 0
3 years ago
Read 2 more answers
• Suppose an application generates chunks of 40 bytes of data every 20 msec, and each chunk gets encapsulated in a TCP segment a
kobusy [5.1K]

Answer:

10

Explanation:

i don't know please just thank me

8 0
3 years ago
Pls help me thx would really help me
Assoli18 [71]

Answer:

rooster don't lay eggs tho

4 0
3 years ago
Read 2 more answers
Define computer memory and write it's type ​
DochEvi [55]

Answer:

Computer memory is a generic term for all of the different types of data storage technology that a computer may use, including RAM, ROM, and flash memory. Some types of computer memory are designed to be very fast, meaning that the central processing unit (CPU) can access data stored there very quickly.

8 0
3 years ago
To complete this quest, answer the following questions in the submission box below. Make x an array going from 0 to 100 by steps
Law Incorporation [45]

Answer:

C++.

Explanation:

#include <iostream.h>

void main(int argc,char* arg[])  {

   // Arrays

   int x[100];

   int y[50];

   int z[50];

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

   int count = 0;

   for (int i = 0; i < 100; i+=2) {

       z[count] = x[i] * y[count];

       count++;

   }

for (int i =0; i < 5; i++) {

   cout<<z[i]<<endl;

}

getche();

}

5 0
3 years ago
Other questions:
  • Which of the following statements will assign the contents of the Text property of a Textbox control named txtInput into the Tex
    10·1 answer
  • Which of the following can indicate what careers will be enjoyable ?
    5·1 answer
  • Why are file naming conventions essential
    13·2 answers
  • What format are a setups program file in before executed?
    12·1 answer
  • 5-16) (Bar Chart Printing Program) One interesting application of computers is to display graphs and bar charts. Write an applic
    10·1 answer
  • The Python print function
    9·1 answer
  • Write code that prompts for three integers, averages them, and prints the average. Make your code robust against invalid input;
    7·1 answer
  • Northern Trail Outfitters stores Last Name in a data extension. How should the text file be defined?
    5·1 answer
  • Five technology tools and their uses​
    5·1 answer
  • When you try to move the desktop icon using the click and drag method and it doesn't move, what is the reason?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!