I need to get an Algorithm (pseudocode and flowchart) note: give a computerized answer.   #include                //header file using namespace std;   float function1(float, float[]);  //function prototype for function1 float function2(float, float[]);  //function prototype for function2 float function3(float[], float[]);  //function prototype for function3 int function4( ); int main( )                    //main function {     float vin, R[4], i[4], v[4];              //declare float variables which are R,i and v     int choice;                              //declare int variables for choice      cout<<"Enter vin: \n";                  //ask user for enter vin     cin>>vin;                               //read  the input     cout<<"Enter R1, R2, R3: \n";        //ask the user enter value R1,R2, and R3     cin>>R[1]>>R[2]>>R[3];               //read input     cout<<"Select from the menu: \n";    //ask user to select the menu     cout<<"1. Calculate i1.\n2. Calculate v2 and i2. \n3.Calculate v3 \n4. Exit \n";  //ask user for select menu     cout<<"Enter a choice: ";   //ask user to enter the choice     cin>>choice;                    //read the choice     i[1]=function1(vin, R);         //function call of the function 1()     i[2]=function2(vin, R);         //function call of the function 2()     v[3]=function3(i, R);           //function call of the function 3()         switch (choice)                     //switch statement choice     {         case 1 : cout<<"\ni1 ="<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

computer programing C++ 
I need to get an Algorithm (pseudocode and flowchart)
note: give a computerized answer.

 

#include<iostream>                //header file

using namespace std;

 

float function1(float, float[]);  //function prototype for function1

float function2(float, float[]);  //function prototype for function2

float function3(float[], float[]);  //function prototype for function3

int function4( );

int main( )                    //main function

{

    float vin, R[4], i[4], v[4];              //declare float variables which are R,i and v

    int choice;                              //declare int variables for choice 

    cout<<"Enter vin: \n";                  //ask user for enter vin

    cin>>vin;                               //read  the input

    cout<<"Enter R1, R2, R3: \n";        //ask the user enter value R1,R2, and R3

    cin>>R[1]>>R[2]>>R[3];               //read input

    cout<<"Select from the menu: \n";    //ask user to select the menu

    cout<<"1. Calculate i1.\n2. Calculate v2 and i2. \n3.Calculate v3 \n4. Exit \n";  //ask user for select menu

    cout<<"Enter a choice: ";   //ask user to enter the choice

    cin>>choice;                    //read the choice

    i[1]=function1(vin, R);         //function call of the function 1()

    i[2]=function2(vin, R);         //function call of the function 2()

    v[3]=function3(i, R);           //function call of the function 3()

   

    switch (choice)                     //switch statement choice

    {

        case 1 : cout<<"\ni1 ="<<i[1];        //display value i1

         break;                                 //system break

        case 2 : cout<<"\nv2 ="<<vin<< "\ni2 = "<<i[2];    //display value v2 and i2

         break;                                      //system break

        case 3 : cout<<"\nv3 ="<<v[3];             //display value v3

         break;                                   //system break

        case 4 : function4();                    //function call of the function4()

         break;                                    //system break

         default: cout<<"Incorrect input!";            //display incorrect input if default

  

    }

return 0;

 

}

float function1(float vin, float R[])                //function definition for function1

{

    float i1 = vin/(R[2]*(R[1]+R[3])/R[1]+R[2]+R[3]);   //calculate value i2 by using this formula

    return i1;

}

float function2(float vin,float R[])                //function definition for function2

{

    float i2 = vin/(R[1]+R[3]);                    //calculate the value of i2 by using this formula

    return i2;

}

float function3(float i[],float R[])           //function definition for function3

{  

    float v3 = i [2]*R[3];                  //calculate the value of v3 by using this formula

    return v3;

}

int function4( )                          //function definition for function4

{

    cout<<"Exit the Program!";      //ask user to exit the program

    exit(0);

}

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY