C++ Programming I would like to make this code like the result(photo submitted). And please let me know how I can open it on notepad.   ----------------------------------------------------------------- Code:   #include #include using namespace std; int main(); int taxi_num=5; int tx1_call=0,tx1_pass=0, tx2_call=0,tx2_pass=0, // Creating global variables tx3_call=0,tx3_pass=0, tx4_call=0,tx4_pass=0, tx5_call=0,tx5_pass=0; int total_passangers=0; // Total passanger count char NeedTaxi(){ if(taxi_num<1) taxi_num=5; char ans; cout<<"\n\nDo you need Taxi (Y/N) : "; cin>>ans; if(ans!='Y' && ans!='N') {cout<<"\n\nError entry !\n\n"; main();} if(ans=='N') return ans; cout<<"Taxi #"<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ Programming

I would like to make this code like the result(photo submitted).

And please let me know how I can open it on notepad.

 

-----------------------------------------------------------------

Code:

 

#include<iostream>
#include<fstream>
using namespace std;
int main();
int taxi_num=5;

int tx1_call=0,tx1_pass=0,
tx2_call=0,tx2_pass=0, // Creating global variables
tx3_call=0,tx3_pass=0,
tx4_call=0,tx4_pass=0,
tx5_call=0,tx5_pass=0;

int total_passangers=0; // Total passanger count

char NeedTaxi(){
if(taxi_num<1) taxi_num=5;
char ans;

cout<<"\n\nDo you need Taxi (Y/N) : ";
cin>>ans;
if(ans!='Y' && ans!='N') {cout<<"\n\nError entry !\n\n"; main();}
if(ans=='N') return ans;
cout<<"Taxi #"<<taxi_num<<" will pick you up in a few minutes.";

if(taxi_num==5) {tx5_call++; tx5_pass+=3;} // Add 3 passangers everytime taxi 5 called
if(taxi_num==4) {tx4_call++; tx4_pass+=5;} // Add 5 passangers everytime taxi 4 called
if(taxi_num==3) {tx3_call++; tx3_pass+=4;} // Add 4 passangers everytime taxi 3 called
if(taxi_num==2) {tx2_call++; tx2_pass+=2;} // Add 2 passangers everytime taxi 2 called
if(taxi_num==1) {tx1_call++; tx1_pass+=3;} // Add 3 passangers everytime taxi 1 called

taxi_num--;

return ans;
}

int main(){
ofstream f("filename.txt");
cout<<"********* Welcome to ABC Taxi *********";
while(NeedTaxi()=='Y'){ NeedTaxi();}

total_passangers+=tx1_pass+tx2_pass+tx3_pass+tx4_pass+tx5_pass;

//Writing the data to the file

f<<"ABC Taxi served a total of "<<total_passangers<<" passengers today\n\n.";
f<<"Taxi 1 Taxi 2 Taxi 3 Taxi 4 Taxi 5 Taxi6\n\n";
f<<tx1_call<<" Calls "<<tx2_call<<" Calls "<<tx3_call<<" Calls "<<tx4_call<<" Calls "<<tx5_call<<" Calls \n\n";
f<<tx1_pass<<" Passanger "<<tx2_pass<<" Passanger "<<tx3_pass<<" Passanger "<<tx4_pass<<" Passanger "<<tx5_pass<<" Passanger \n\n";
f.close();

}

----------------------

**********  Welcome to ABC Taxi  **********

Do you need Taxi (Y/N) : Y
Taxi #5 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #4 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #3 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #2 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #1 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #5 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #4 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #3 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #2 will pick you up in a few minutes.

Do you need Taxi (Y/N) : Y
Taxi #1 will pick you up in a few minutes.

Do you need Taxi (Y/N) : N

Process returned 0 (0x0)  execution time : 10.638 s
Press any key to continue.
Transcribed Image Text:********** Welcome to ABC Taxi ********** Do you need Taxi (Y/N) : Y Taxi #5 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #4 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #3 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #2 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #1 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #5 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #4 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #3 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #2 will pick you up in a few minutes. Do you need Taxi (Y/N) : Y Taxi #1 will pick you up in a few minutes. Do you need Taxi (Y/N) : N Process returned 0 (0x0) execution time : 10.638 s Press any key to continue.
### ABC Taxi Service Daily Report

**ABC Taxi served a total of 34 passengers today.**

Here is the breakdown of the number of calls and passengers served by each taxi:

---
**Taxi 1**
- Calls: 2
- Passengers: 6

**Taxi 2**
- Calls: 2 
- Passengers: 4

**Taxi 3**
- Calls: 2
- Passengers: 8

**Taxi 4**
- Calls: 2
- Passengers: 10

**Taxi 5**
- Calls: 2
- Passengers: 6

---

**Summary:**
- The five taxis received a total of 10 calls.
- Combined, they served 34 passengers.

This data helps in understanding the daily performance and passenger distribution among the taxis operating under ABC Taxi.
Transcribed Image Text:### ABC Taxi Service Daily Report **ABC Taxi served a total of 34 passengers today.** Here is the breakdown of the number of calls and passengers served by each taxi: --- **Taxi 1** - Calls: 2 - Passengers: 6 **Taxi 2** - Calls: 2 - Passengers: 4 **Taxi 3** - Calls: 2 - Passengers: 8 **Taxi 4** - Calls: 2 - Passengers: 10 **Taxi 5** - Calls: 2 - Passengers: 6 --- **Summary:** - The five taxis received a total of 10 calls. - Combined, they served 34 passengers. This data helps in understanding the daily performance and passenger distribution among the taxis operating under ABC Taxi.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education