Make an algorithm of this C++ code    #include #include #include   using namespace std;   int main() {   char fname[50], lname[50], phonenum [15], pname[50];   int opt, n, x, qty, num, cont=1, month, day, year;     while(cont==1)   {             cout<<"============================================================================"<>n;       switch (n)     {     case 1:         system("cls");         {         cout<<"Please enter buyer's First name: "<"; cin>>fname;         cout<"; cin>>lname;         cout<>month;         cout<<"Day (DD): "; cin>>day;         cout<<"Year (YYYY): "; cin>>year;         cout<>phonenum;         cout<>x;         system("cls");          string pname[x];          float price[x], qty[x], total=0;          for(int i=0; i>pname[i];              cout<>qty[i];              cout<>price[i];              cout<>cont;     cout<

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
100%

Make an algorithm of this C++ code 

 

#include <iostream>

#include <string.h>

#include <stdlib.h>

 

using namespace std;

 

int main()

{

  char fname[50], lname[50], phonenum [15], pname[50];

  int opt, n, x, qty, num, cont=1, month, day, year;

 

  while(cont==1)

  {

 

 

        cout<<"============================================================================"<<endl;

        cout<<"                             RECEIPT MAKER"<<endl;

        cout<<"============================================================================"<<endl<<endl;

        cout<<"To start, please choose one"<<endl<<endl;

        cout<<"1. Make receipt"<<endl;

        cout<<"2. Exit"<<endl;

        cout<<"============================================================================"<<endl<<endl;

        cout<<"Please enter the number of chosen process: "<<endl<<endl;

        cin>>n;

 

    switch (n)

    {

    case 1:

        system("cls");

        {

        cout<<"Please enter buyer's First name: "<<endl;

        cout<<"-->"; cin>>fname;

        cout<<endl;

 

        cout<<"Please enter buyer's Last name: "<<endl;

         cout<<"-->"; cin>>lname;

        cout<<endl;

 

        cout<<"Date of Purchase"<<endl;

        cout<<"Month(MM): "; cin>>month;

        cout<<"Day (DD): "; cin>>day;

        cout<<"Year (YYYY): "; cin>>year;

        cout<<endl;

 

        cout<<"Phone Number: "; cin>>phonenum;

        cout<<endl;

 

        cout<<"How many orders do you wish to input?"<<endl;

        cin>>x;

        system("cls");

         string pname[x];

         float price[x], qty[x], total=0;

         for(int i=0; i<x; i++)

         {

             cout<<"Enter product code of item #"<<i+1<<" :"<<endl;

             cin>>pname[i];

             cout<<endl;

 

             cout<<"Quantity"<<endl;

             cin>>qty[i];

             cout<<endl;

 

             cout<<"Price"<<endl;

             cin>>price[i];

             cout<<endl;

            }

 

        for(int j=0; j<x; j++)

        {

            total+=(price[j]*qty[j]);

        }

        system("cls");

            cout<<"============================================================================"<<endl;

            cout<<"                             RECEIPT"<<endl;

            cout<<"============================================================================"<<endl<<endl;

            cout<<"Name of Buyer: "<<fname<<" "<<lname;

            cout<<endl;

            cout<<"Date of Purchase (MM/DD/YYYY): "<<month<<" "<<day<<" "<<year<<endl;

            cout<<"Product code: "<<"\t Quantity: "<<"\t Price: "<<endl;

            for(int i=0; i<x; i++)

            {

                cout<<pname[i]<<"\t\t"<<qty[i]<<"\t\t"<<price[i]<<endl;

            }

            cout<<"============================================================================"<<endl;

            cout<<"Total Amount: "<<"\t\t\t\t"<<total<<endl<<endl<<endl;

 

 

             break;

         }

    case 2:

        {

        system("cls");

        cout<<endl<<"Thank you for using this program!"<<endl<<endl<<endl;

                break;

        }

    default:

         {

        cout<<endl<<"Please enter 1 and 2 only"<<endl;

        break;

         }

    }

    cout<<"Do you want to make another receipt? ['1' = yes or '0' = no]: ";

    cin>>cont;

    cout<<endl;

    system("cls");

    }

    return 0;

  }

 

 

End
-No
Output
thank you
message
Start
Declare char variables
fname, Iname, phonenum,
pname
Declare integers
opt, n, x, qty, num,
cont=1, month, day,
and year
is cont==1?
Yes
Choose
a process
Output total
amount
input cont
Input fname, Iname,
-1 month, day, year,
and phonenum.
No.
Input x
output
pname[i],
qty[i],
price[i]
Yes
for(int i=0; i<x; i++)
Output fname,
Iname, month,
day, and year.
declare float
variables price[x],
qty[x], and total=0
-No-
Yes-
total+=(price[j]*qty[j])
Yes
for(int j=0; j<x; j++)
No
for(int i=0; i<x; i++)
-Yes-
Input
pname[i],
qty[i],
price[i
Transcribed Image Text:End -No Output thank you message Start Declare char variables fname, Iname, phonenum, pname Declare integers opt, n, x, qty, num, cont=1, month, day, and year is cont==1? Yes Choose a process Output total amount input cont Input fname, Iname, -1 month, day, year, and phonenum. No. Input x output pname[i], qty[i], price[i] Yes for(int i=0; i<x; i++) Output fname, Iname, month, day, and year. declare float variables price[x], qty[x], and total=0 -No- Yes- total+=(price[j]*qty[j]) Yes for(int j=0; j<x; j++) No for(int i=0; i<x; i++) -Yes- Input pname[i], qty[i], price[i
Expert Solution
steps

Step by step

Solved in 2 steps

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