Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ Do the red color lines in the given code below Attach your code below Then give all your output, as mentioned In red

Using C++

Do the red color lines in the given code below Attach your code below Then give all your output, as mentioned In red color in main()

Sample code: #include

using namespace std;

const int CITY_NO = 5; float Volt[CITY_NO]; float Cur[CITY_NO]; float Pow[CITY_NO];

void input_volt(void) { int i; for(i=0; i> Volt[i]; } }

// write a similar function input_current() // to input current for all cities one by one // and store in Cur[] array // give realistic values as input currents and input voltages

// write a function calculate_power() // to calculate Pow[i] = Volt[i]*Cur[i] // and store in Pow[i] array

void output_volt(void) { int i; for(i=0; i

//write similar functions for output all city current // write similar function for output all city power

void max_volt() { int max, i, max_city; max = Volt[0]; max_city = 0; for(i=1; i max) { max = Volt[i]; max_city = i; } } cout << "Maximum voltage: " << max; cout << " in city " << max_city; }

//write similar functions for output maximum current and that city number // write similar function for output maximum power and that city number

void sum_avg_volt(void) { int i; float sum, avg; sum = 0; for(i=0; i

//write similar functions for output average current // write similar function for output average power

void city_volt() { int x; cout << "Enter city number to see its voltage: "; cin >> x; cout << "Voltage of city " << x << ": " << Volt[x]; }

//write similar functions for output city current // write similar function for output city power

int main(void) { input_volt(); //input_current(); output_volt(); //output_current(); //output_power(); city_volt(); //city_current(); //city_power(); max_volt(); //max_current(); //max_power(); sum_avg_volt(); //sum_avg_current(); //sum_avg_power(); }

Sample output:

Put your code here:

Put your screen picture here:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3.2. Describe the DSM-5 approach to diagnosing mental disorders ?

Answered: 1 week ago

Question

Define the goals of persuasive speaking

Answered: 1 week ago