- ๐ป I'm currently learning backend development from this roadmap
- โค๏ธ I'm a user and lover of linux
railwaycli's Introduction
railwaycli's People
railwaycli's Issues
includes and namespace
Documents
Create Person struct
Person struct
Lines 8 to 14 in 021ebb1
Input: 5 & other
Input: 2
Input: 3
Input: 1
Task 1. Reserve a Seat
Lines 301 to 305 in 021ebb1
so, we need to reserve a new seat between 10 compartments & 6 Seats on every of them
Lines 140 to 181 in 021ebb1
i create an object of
Person
for working with input datafirst we most initial an object from
ifstream
and ofstream
on the fstream
Library
give person.name
& person.family
from client and make those ::tolower
put name and family together and make new string fullName
maybe you question why we do that??
for better query on database Train.txt
cause data save like this:
sara, irani, 9, 6
ehsan , reziea, 10, 1
when we gonna know about this name is record on database or not
we must use this format <person.name>, <person.family>
for search
then pass fullName
to bool HaveTicket(string searchContent)
function
Lines 16 to 34 in 021ebb1
that a bool function, so, return true false value
if data base have same name and family call another method whose name
void ShowTicket(string personFullName)
Lines 82 to 120 in 021ebb1
that output something like this
-- Ticket Added Successfully! --
---------TICKET----------
Name: sara
Family: irani
Compartment: 1
Seat: 1
-------------------------
give different name, family on reserve compartment
- when reserve a compartment give 6 name and family for 6 seats on compartment when available
Lines 183 to 226 in 021ebb1
Task List
Input: 4
output 01
โฏ .\a.exe
---- RAILWAY Cli ----
1. Reserve a Seat
2. Reserve a Compartment
3. Check Ticket
4. Ticket Refund
5. Exit
Please Choose Number: 2
Enter Passenger name: ali
Enter Passenger family: koleiny
-- Tickets Added Successfully! --
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
1. Reserve a Seat
2. Reserve a Compartment
3. Check Ticket
4. Ticket Refund
5. Exit
Please Choose Number: 4
Enter Passenger Name: ali
Enter Passenger Family: koleiny
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 1
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 2
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 3
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 4
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 5
-------------------------
---------TICKET----------
Name: ali
Family: koleiny
Compartment: 1
Seat: 6
-------------------------
-- Ticket Refunded Successfully!--
1. Reserve a Seat
2. Reserve a Compartment
3. Check Ticket
4. Ticket Refund
5. Exit
Please Choose Number:
main
main function
Lines 283 to 345 in 021ebb1
in switch case statement, don't worry about
e1, e2 ,e3, ...
and so on.when we use normally
1, 2, 3, ...
and client is type like
53
get stuck at a infinite loop and crasheven though we use
default:
key word on last case,so, we need two use something different for this issue
use
enum
!and translate elements to numbers like this:
Lines 263 to 281 in 021ebb1
Input: 1
Input 1. Reserve a Seat
Lines 301 to 305 in 021ebb1
so, we need to reserve a new seat between 10 compartments & 6 Seats on every of them
Lines 140 to 181 in 021ebb1
i create an object of
Person
for working with input datafirst we most initial an object from
ifstream
and ofstream
on the fstream
Library
give person.name
& person.family
from client and make those ::tolower
put name and family together and make new string fullName
maybe you question why we do that??
for better query on database Train.txt
cause data save like this:
sara, irani, 9, 6
ehsan , reziea, 10, 1
when we gonna know about this name is record on database or not
we must use this format <person.name>, <person.family>
for search
then pass fullName
to bool HaveTicket(string searchContent)
function
Lines 16 to 34 in 021ebb1
that a bool function, so, return true false value
if data base have same name and family call another method whose name
void ShowTicket(string personFullName)
Lines 82 to 120 in 021ebb1
that output something like this
-- Ticket Added Successfully! --
---------TICKET----------
Name: sara
Family: irani
Compartment: 9
Seat: 6
-------------------------
show different data when check a compartmant
show ticket when refund
- when refund a ticket show data of tickets was refunded
Lines 228 to 261 in 021ebb1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.