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 ____ method returns an integer that represents the location of the substring within the string.
enot [183]

Insert Method

it is used to returns an integer that speaks to the area of the substring inside the string.

5 0
3 years ago
Write a function named shareALetter that takes one parameter, wordList – a list of words. Create and return a dictionary in whic
Arte-miy333 [17]
Can u send anything to understand it
7 0
2 years ago
Which of the following scenarios falls into the category of network crimes?
solong [7]

Answer:

B

Explanation:

Hope it helps!

3 0
2 years ago
Read 2 more answers
using a timer to generate a random number, develop a program that displays random numbers between 1 and 47 (or whatever) for you
mestny [16]

Answer:

Explanation:

The following code is written in Python. It creates a variable that detects the current time. Then it loops through a range of numbers and chooses the last random number after 2 seconds. Finally, it prints that number to the screen. This function can be called countless times depending on the number of state lottery numbers needed.

import random

import time

start_time = time.time()

while time.time() - start_time < 2:

   lottery_number = random.randint(0, 48)

print(lottery_number)

3 0
3 years ago
If the Snort IDS captures the IP packets off the LAN segment for examination, is this an example of promiscuous mode operation
vodomira [7]

Answer:

i now why read this

Explanation:

We're no strangers to love

You know the rules and so do I

A full commitment's what I'm thinking of

You wouldn't get this from any other guy

I just wanna tell you how I'm feeling

Gotta make you understand

Never gonna give you up

Never gonna let you down

Never gonna run around and desert you

Never gonna make you cry

Never gonna say goodbye

Never gonna tell a lie and hurt you

We've known each other for so long

Your heart's been aching but you're too shy to say it

Inside we both know what's been going on

We know the game and we're gonna play it

And if you ask me how I'm feeling

Don't tell me you're too blind to see

Never gonna give you up

Never gonna let you down

Never gonna run around and desert you

Never gonna make you cry

Never gonna say goodbye

Never gonna tell a lie and hurt you

Never gonna give you up

Never gonna let you down

Never gonna run around and desert you

Never gonna make you cry

Never gonna say goodbye

Never gonna tell a lie and hurt you

(Give you up)

(Ooh) Never gonna give, never gonna give

(Give you up)

We've known each other for so long

Your heart's been aching but you're too shy to say it

Inside we both know what's been going on

We know the game and we're gonna play it

I just wanna tell you how I'm feeling

Gotta make you understand

Never gonna give you up

Never gonna let you down

Never gonna run around and desert you

Never gonna make you cry

Never gonna say goodbye

Never gonna tell a lie and hurt you

Never gonna give you up

Never gonna let you down

Never gonna run around and desert you

Never gonna make you cry

Never gonna say goodbye

Never gonna tell a lie and hurt you

Never gonna give you up

Never gonna let you down

Never gonna run around and desert you

Never gonna make you cry

Never gonna say goodbye

5 0
3 years ago
Other questions:
  • Sam wanted to open a file that he saved yesterday. Which component inside the computer stores this file? the hard drive the fax
    13·2 answers
  • Is anyone else experiencing the wording::nonifacation::glitch about the "5 hours ago" thingy to whenever you answer a question o
    7·2 answers
  • What is one way for an entrepreneur to decrease risk?
    8·1 answer
  • Write a program to add two number marie simulator.
    15·1 answer
  • Judy forgot where she saved a certain file on her computer. Therefore, she searches for all files with a .jpg file extension. Wh
    10·2 answers
  • What type of device does a computer turn to first when attempting to make contact with a host with a known IP address on another
    9·2 answers
  • Which of the following best explains what the profit motive pushes producers to do
    9·1 answer
  • 2. What is data redundancy?
    14·1 answer
  • What is network topology? PLZZZ HURRY
    9·1 answer
  • When USB flash drives started becoming popular, customers stopped purchasing CDs. As a result, USB flash drives almost completel
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!