Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question: Write a program that computes the average, variance, minimum, and maxi

ID: 3626240 • Letter: Q

Question

Question:
Write a program that computes the average, variance, minimum, and maximum of the resistor
voltages given the resistor's current and resistance from a le named rawdata.txt. The le
contains the resistor's currents (in milliamps) and resistances (in Ohms), where the currents and
resistances are listed in the rst and second columns, respectively. The program must declare
one-dimensional arrays named volt, current, and resistance. Each array must be capable of
holding double-precision numbers. Use array variables current and resistance to hold the data
from the le. Dene and use a function named calc volt to compute a single value for the
voltage across a resistor given single values for the current and resistance.
1
Use cout to display the average, variance, minimum, and maximum values of all three arrays:
VOLT (V)
AVG x.xxx
VAR x.xxx
MIN x.xxx
MAX x.xxx
Also, have the program write the above output to a le named data.txt.


The program has errors that i can not detect. Please help!!!


#include<iostream>
#include<iomanip>
#include<fstream>
#include<cmath>

using namespace std;

int Calc_volt(int x[], int volt);

int main()
{
ifstream inFile;
ofstream outFile;

inFile.open("rawdata.txt");
outFile.open("wordpad.txt");

int *C; // declare current
int *R; // declare resistance
int *Calc_volt;// calculate voltage
int i;
int vo;
int volt;


double sum_average=0;// adds the voltage for each index
double average_volt=0;// calculate the average voltage
double num1,num2;

i=0;
while( !(inFile.eof()) )//send data
{
inFile>> num1>> num2;
i++;
}
vo=i;

R=new int [i];
C=new int[i];
Calc_volt=new int[i];

delete []R;
delete []C;
delete []Calc_volt;

for (i=0; i<vo; i++)
{
inFile>>num1>>num2;
C[i]=num1;
R[i]=num2;

Explanation / Answer

Hey buddy! Could you please give me the point? I really need them... I promise to return the favor ;)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote