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<
Make an
#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 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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8e8e77a6-3db1-4acd-a7df-4a390e4e7211%2F9fb72a90-1936-4bed-ae26-96cc22fe55c2%2Fhk1xsdf_processed.png&w=3840&q=75)

Step by step
Solved in 2 steps









