Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stack>
- #include <fstream>
- #include <string>
- using namespace std;
- int main()
- {
- int menu=0;
- ifstream file;
- string line;
- string C0 = "Lawrence"; //Origin city
- stack <string> stk;
- stk.push(C0); //Add origin city in stack
- cout << "FlexAir \n 1. All available cities \n 2. Available routes \n 3. Booked flights \n 4.Exit \n Your choice: "; cin >> menu;
- if (menu == 1) {
- file.open("City.txt");
- while (!file.eof()) {
- getline(file, line);
- cout << line << endl;
- for (int i = 0; i < line.length(); i++) {
- stk.push(line);
- }
- }
- }
- if (menu == 2) {
- file.open("From.txt");
- while (!file.eof()) {
- getline(file, line);
- cout << line << endl;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment