Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <fstream>
- #include <bitset>
- using namespace std;
- struct bank {
- char name[20];
- int BGN = 0, EUR = 0, USD = 0;
- int acc_no;
- int day;
- int month;
- int year;
- };
- // Декларирана Структура
- void depositor(bank* D, int& depositorCount);
- void multiple(bank* D, int& depositorCount);
- void showBGN(bank* D, int& depositorCount);
- void showEUR(bank* D, int& depositorCount);
- void withdraw(bank* D, int& depositorCount);
- void WriteToBinary(bank* D, int& depositorCount);
- int readBinary(bank* D);
- void sort(bank* D, int& depositorCount);
- void createDepositor(bank* D, int& depositorCount, bank newDepositor)
- {
- D[depositorCount] = newDepositor;
- depositorCount++;
- }
- // Брояч за депоситори
- void main()
- {
- bank D[50];
- int choiceBinary;
- int adddepositor = readBinary(D);
- int ch;
- do {
- cout << "\t ----------------------------------------" << endl;
- cout << "\t MAIN MENU" << endl;
- cout << "\t ----------------------------------------" << endl;
- cout << "\t| 1. Add Depositor |" << endl;
- cout << "\t| 2. Add multiple depositors |" << endl;
- cout << "\t| 3. Show all depositors with value BGN |" << endl;
- cout << "\t| 4. Show depositor with max deposit EUR |" << endl;
- cout << "\t| 5. Withdraw |" << endl;
- cout << "\t| 6. Sort profiles |" << endl;
- cout << "\t| 7. Save binary to file |" << endl;
- cout << "\t| 8. Exit |" << endl;
- cout << "\t ----------------------------------------" << endl;
- // Това е главното меню
- do {
- cout << "\n\t YOUR CHOICE IS: ";
- cin >> ch;
- } while (ch < 1 || ch>8);
- switch (ch)
- {
- case 1: depositor(D, adddepositor); break;
- case 2: multiple(D, adddepositor); break;
- case 3: showBGN(D, adddepositor); break;
- case 4: showEUR(D, adddepositor); break;
- case 5: withdraw(D, adddepositor); break;
- case 6: sort(D, adddepositor); break;
- case 7: WriteToBinary(D, adddepositor); break;
- }
- } while (ch != 8);
- } // Това е цялото меню в което се съдържа switch която праща към case-овете
- void depositor(bank* D, int& depositorCount)
- {
- bank newdepositor;
- int n, ch, choice;
- int deposit;
- int bg1 = 0, bg2 = 0, bg3 = 0;
- int usd1 = 0, usd2 = 0, usd3 = 0;
- int eur1 = 0, eur2 = 0, eur3 = 0;
- system("cls");
- cout << "\n DEPOSITOR ACCOUNT:" << endl; // В тази функция може да се въведе само 1 депоситор
- cout << "\n Enter name: ";
- cin.ignore();
- cin >> newdepositor.name;
- cout << "\n Create account number:";
- cin >> newdepositor.acc_no;
- if (newdepositor.acc_no < 1)
- {
- system("cls");
- cout << "\t|--------------------------------------|" << endl;
- cout << "\t| Your account number cant be under 1 |" << endl;
- cout << "\t|--------------------------------------|" << endl;
- return;
- }
- for (int i = 0; i < depositorCount; i++)
- {
- if (newdepositor.acc_no == D[i].acc_no)
- {
- system("cls");
- cout << " This account number already exist, please enter a different number" << endl;
- return;
- }
- }
- // Ако депоситорите са повече от 50 програмата ще прекъсне броенето и ще се върне назад към менюто
- cout << "\n Enter day: ";
- cin >> newdepositor.day;
- cout << "\n Enter month (in numbers): ";
- cin >> newdepositor.month;
- cout << "\n Enter year: ";
- cin >> newdepositor.year;
- do {
- cout << "\n 1. New Depositor";
- cout << "\n 2. Go back to main menu ";
- cout << "\n Choose option: ";
- cin >> ch;
- if (ch < 1 || ch > 2)
- {
- system("cls");
- cout << "|----------------------|" << endl;
- cout << "| Please select 1 or 2 |" << endl;
- cout << "|----------------------|" << endl;
- } // Ако се избере по-малко от 1 или по-голямо от 2 програмата ще се прекрати
- else if (ch == 2)
- {
- system("cls");
- return;
- } // Ако се избере 2 ще се върне към главното меню
- } while (ch < 1 || ch > 2);
- do {
- cout << "\n 1. Deposit";
- cout << "\n Choose option:";
- cin >> ch;
- if (ch < 1 || ch > 1)
- {
- system("cls");
- cout << "|---------------------------------|" << endl;
- cout << "| Please select the first option! |" << endl;
- cout << "|---------------------------------|" << endl;
- }// Ако се избере по-малко от 1 или по-голямо от 2 програмата ще се прекрати
- } while (ch != 1);
- cout << "\n How many deposits you want to make? ";
- cin >> deposit;
- for (int i = 0; i < deposit; i++) // Брояч за влогове
- {
- if (deposit < 1)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| Minimum deposit for your account is 1 |" << endl;
- cout << "| Please try again |" << endl;
- cout << "|-----------------------------------------|" << endl;
- return;
- }
- if (deposit > 3)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| Maximum deposits for your account is 3 |" << endl;
- cout << "| Please try again |" << endl;
- cout << "|-----------------------------------------|" << endl;
- return;
- }
- // Максимума на влоговете е 3 и ако се избере повече от 3 програмата ще се прекрати
- do {
- cout << "\n Values:" << endl;
- cout << "\n 1. BGN";
- cout << "\n 2 .USD";
- cout << "\n 3. EUR";
- cout << "\n Choose your value: ";
- cin >> choice;
- if (choice < 1 || choice > 3)
- {
- system("cls");
- cout << "|---------------------------------|" << endl;
- cout << "| Please enter number from 1 to 3 |" << endl;
- cout << "|---------------------------------|" << endl;
- }
- if (choice == 1)
- {
- if (deposit == 3)
- {
- cout << "\n How much you want to deposit: ";
- cin >> bg3;
- }
- if (deposit < 3)
- {
- cout << "\n How much you want to deposit (Minimum is 500 BGN): ";
- if (choice == 1 || deposit == 1)
- {
- cin >> bg1;
- }
- else if (choice == 1 || deposit == 2)
- {
- cin >> bg1 >> bg2;
- }
- if (bg1 < 500)
- {
- system("cls");
- cout << "|-------------------------------------------------------|" << endl;
- cout << "| Minimum deposit is 500 BGN for deposits under 3 times |" << endl;
- cout << "|-------------------------------------------------------|" << endl << endl;
- return;
- }
- }
- newdepositor.BGN += bg1 + bg2 + bg3; // Събира стойностите на вкараните суми в една обща
- }
- if (choice == 2)
- {
- if (deposit == 3)
- {
- cout << "\n How much you want to deposit: ";
- cin >> usd3;
- }
- if (deposit < 3)
- {
- cout << "\n How much you want to deposit (Minimum is 500 USD): ";
- if (choice == 2 || deposit == 1)
- {
- cin >> usd1;
- }
- else if (choice == 2 || deposit == 2)
- {
- cin >> usd1 >> usd2;
- }
- if (usd1 < 500)
- {
- system("cls");
- cout << "|-------------------------------------------------------|" << endl;
- cout << "| Minimum deposit is 500 USD for deposits under 3 times |" << endl;
- cout << "|-------------------------------------------------------|" << endl << endl;
- return;
- }
- }
- newdepositor.USD += usd1 + usd2 + usd3; // Събира стойностите на вкараните суми в една обща
- }
- if (choice == 3)
- {
- if (deposit == 3)
- {
- cout << "\n How much you want to deposit: ";
- cin >> eur3;
- }
- if (deposit < 3)
- {
- cout << "\n How much you want to deposit (Minimum is 500 EUR): ";
- if (choice == 3 || deposit == 1)
- {
- cin >> eur1;
- }
- else if (choice == 3 || deposit == 2)
- {
- cin >> eur1 >> eur2;
- }
- if (eur1 < 500)
- {
- system("cls");
- cout << "|-------------------------------------------------------|" << endl;
- cout << "| Minimum deposit is 500 EUR for deposits under 3 times |" << endl;
- cout << "|-------------------------------------------------------|" << endl << endl;
- return;
- }
- }
- newdepositor.EUR += eur1 + eur2 + eur3; // Събира стойностите на вкараните суми в една обща
- }
- } while (choice < 1 || choice >3);
- }
- createDepositor(D, depositorCount, newdepositor);
- system("cls");
- }
- void multiple(bank* D, int& depositorCount)
- {
- bank newdepositor;
- int deposit, n, ch;
- int bg1 = 0, bg2 = 0, bg3 = 0;
- int usd1 = 0, usd2 = 0, usd3 = 0;
- int eur1 = 0, eur2 = 0, eur3 = 0;
- cout << "\n How many depositors do you want to add?" << endl;
- cin >> n;
- for (int i = 0; i < n; i++) // Този брояч следи колко хора са въведени от интеджера "n", и ако са повече от 1 ще се повтори до толкова колкото са на брой
- {
- if (n < 1)
- {
- system("cls");
- cout << "\n The minimum is 1 depositor" << endl;
- cout << "\n Please try again" << endl;
- return;
- }
- else if (n > 50)
- {
- system("cls");
- cout << "\n The maximum is 50" << endl;
- cout << "\n Please try again" << endl;
- return;
- }
- // Ако депоситорите са повече от 50 програмата ще прекъсне броенето и ще се върне назад към менюто
- system("cls");
- cout << "\n DEPOSITOR ACCOUNT:" << endl;
- cout << "\n Enter name: ";
- cin.ignore();
- cin >> newdepositor.name;
- cout << "\n Create account number:";
- cin >> newdepositor.acc_no;
- if (newdepositor.acc_no < 1)
- {
- system("cls");
- cout << "\t|--------------------------------------|" << endl;
- cout << "\t| Your account number cant be under 1 |" << endl;
- cout << "\t|--------------------------------------|" << endl;
- return;
- }// Ако номера на акаунта е под 1 ще излезе грешка и програмата ще спре
- for (int i = 0; i < depositorCount; i++)
- {
- if (newdepositor.acc_no == D[i].acc_no)
- {
- system("cls");
- cout << " This account number already exist, please enter a different number" << endl;
- return;
- }
- }
- // Тука се проверява ако номера на акаунта вече съществува ще излезе грешка
- cout << "\n Enter day: ";
- cin >> newdepositor.day;
- cout << "\n Enter month: ";
- cin >> newdepositor.month;
- cout << "\n Enter year: ";
- cin >> newdepositor.year;
- do {
- cout << "\n 1. New Depositor";
- cout << "\n 2. Go back to main menu ";
- cout << "\n Choose option: ";
- cin >> ch;
- if (ch < 1 || ch > 2)
- {
- system("cls");
- cout << "|----------------------|" << endl;
- cout << "| Please select 1 or 2 |" << endl;
- cout << "|----------------------|" << endl;
- }
- else if (ch == 2)
- {
- system("cls");
- return;
- }
- } while (ch < 1 || ch > 2);
- do {
- cout << "\n 1. Deposit";
- cout << "\n Choose option:";
- cin >> ch;
- if (ch < 1 || ch > 1)
- {
- system("cls");
- cout << "|---------------------------------|" << endl;
- cout << "| Please select the first option! |" << endl;
- cout << "|---------------------------------|" << endl;
- }
- } while (ch != 1);
- cout << "\n How many deposits you want to make? ";
- cin >> deposit;
- for (int i = 0; i < deposit; i++)
- {
- if (deposit > 3)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| Maximum deposits for your account is 3 |" << endl;
- cout << "| Please try again |" << endl;
- cout << "|-----------------------------------------|" << endl;
- break;
- }
- else if (deposit < 1)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| Minimum deposit for your account is 1 |" << endl;
- cout << "| Please try again |" << endl;
- cout << "|-----------------------------------------|" << endl;
- break;
- }
- do {
- cout << "\n Values:" << endl;
- cout << "\n 1. BGN";
- cout << "\n 2 .USD";
- cout << "\n 3. EUR";
- cout << "\n Choose your value: ";
- cin >> ch;
- if (ch < 1 || ch > 3)
- {
- cout << "\n Please enter number from 1 to 3";
- }
- if (ch == 1)
- {
- if (deposit == 3)
- {
- cout << "\n How much you want to deposit: ";
- cin >> bg3;
- }
- if (deposit < 3)
- {
- cout << "\n How much you want to deposit (Minimum is 500 BGN): ";
- if (ch == 1 || deposit == 1)
- {
- cin >> bg1;
- }
- else if (ch == 1 || deposit == 2)
- {
- cin >> bg1 >> bg2;
- }
- if (bg1 < 500)
- {
- system("cls");
- cout << "|-------------------------------------------------------|" << endl;
- cout << "| Minimum deposit is 500 BGN for deposits under 3 times |" << endl;
- cout << "|-------------------------------------------------------|" << endl << endl;
- return;
- }
- }
- newdepositor.BGN += bg1 + bg2 + bg3;
- }
- if (ch == 2)
- {
- if (deposit == 3)
- {
- cout << "\n How much you want to deposit: ";
- cin >> usd3;
- }
- if (deposit < 3)
- {
- cout << "\n How much you want to deposit (Minimum is 500 USD): ";
- if (ch == 2 || deposit == 1)
- {
- cin >> usd1;
- }
- else if (ch == 2 || deposit == 2)
- {
- cin >> usd1 >> usd2;
- }
- if (usd1 < 500)
- {
- system("cls");
- cout << "|-------------------------------------------------------|" << endl;
- cout << "| Minimum deposit is 500 USD for deposits under 3 times |" << endl;
- cout << "|-------------------------------------------------------|" << endl << endl;
- return;
- }
- }
- newdepositor.USD += usd1 + usd2 + usd3;
- }
- if (ch == 3)
- {
- if (deposit == 3)
- {
- cout << "\n How much you want to deposit: ";
- cin >> eur3;
- }
- if (deposit < 3)
- {
- cout << "\n How much you want to deposit (Minimum is 500 EUR): ";
- if (ch == 3 || deposit == 1)
- {
- cin >> eur1;
- }
- else if (ch == 3 || deposit == 2)
- {
- cin >> eur1 >> eur2;
- }
- if (eur1 < 500)
- {
- system("cls");
- cout << "|-------------------------------------------------------|" << endl;
- cout << "| Minimum deposit is 500 EUR for deposits under 3 times |" << endl;
- cout << "|-------------------------------------------------------|" << endl << endl;
- return;
- }
- }
- newdepositor.EUR += eur1 + eur2 + eur3;
- }
- // Ако се избере под 3 депосита програмата ще направи така че минимума от валутата която е въведена да бъде 500
- } while (ch < 1 || ch>3);
- }createDepositor(D, depositorCount, newdepositor);
- }system("cls");
- }
- void showBGN(bank* D, int& depositorCount)
- {
- if (depositorCount < 1)
- {
- system("cls");
- cout << "|-------------------------------------------------------------|" << endl;
- cout << "| There are not depositors added yet ! |" << endl;
- cout << "| You can add some buy choose the option in main menu 1 or 2. |" << endl;
- cout << "|-------------------------------------------------------------|" << endl;
- }
- // Ако не са добавени депоситори функцията ще даде грешка
- else if (depositorCount > 0)
- {
- system("cls");
- cout << "|------------------------------------------|" << endl;
- cout << "| These are all depositors with value BGN |" << endl;
- cout << "|------------------------------------------|" << endl;
- for (int i = 0; i < depositorCount; i++)
- {
- if (D[i].BGN > 0)
- {
- cout << " NAME: " << D[i].name << endl;
- cout << " MONEY DEPOSIT: " << D[i].BGN << " lv" << endl;
- }
- }
- }// Изписва всички депоситори които са депоситнали с BGN
- }
- void showEUR(bank* D, int& depositorCount)
- {
- if (depositorCount < 1)
- {
- system("cls");
- cout << "|-------------------------------------------------------------|" << endl;
- cout << "| There are not depositors added yet ! |" << endl;
- cout << "| You can add some buy choose the option in main menu 1 or 2. |" << endl;
- cout << "|-------------------------------------------------------------|" << endl;
- }
- else if (depositorCount > 0)
- {
- int max = 0;
- for (int i = 0; i < depositorCount; i++)
- {
- if (D[i].EUR > max)
- {
- max = D[i].EUR;
- }// Ако еврото е по-голямо от макса, то макса равно на еврото
- }
- for (int i = 0; i < depositorCount; i++)
- {
- if (D[i].EUR == max)
- {
- system("cls");
- cout << " Depositor ( " << D[i].name << " ) with ACCOUNT number ( " << D[i].acc_no << " ) has the biggest deposit of ( " << max << " ) EUR." << endl;
- }
- }
- }
- }
- // Функцията ще покаже максимума с еврото
- void withdraw(bank* D, int& depositorCount)
- {
- bank newdepositor;
- int search;
- int ch;
- int wdraw;
- int balance;
- if (depositorCount < 1)
- {
- system("cls");
- cout << "|-------------------------------------------------------------|" << endl;
- cout << "| You haven't deposit yet ! |" << endl;
- cout << "| You can deposit by choose the option in main menu 1 or 2. |" << endl;
- cout << "|-------------------------------------------------------------|" << endl;
- }
- // Ако не са добавени депоситори тази функция не може да се използва
- else if (depositorCount > 0)
- {
- system("cls");
- cout << "\n Enter your account number: ";
- cin >> search;
- for (int i = 0; i < depositorCount; i++)
- {
- if (search == D[i].acc_no)// Ако номера на акаунта съществува програмата ще продължи
- {
- do {
- cout << "|----------------------------------------------|" << endl;
- cout << "| 1. Withdraw everything and Shut down profile |" << endl;
- cout << "|----------------------------------------------|" << endl << endl;
- cout << "\n Values:" << endl;
- cout << "\n 2. BGN";
- cout << "\n 3. USD";
- cout << "\n 4. EUR";
- cout << "\n Choose option: ";
- cin >> ch;
- if (ch < 1 || ch > 4)
- {
- cout << "\n Please enter number from 1 to 5";
- }// Изборът трябва да от 1 до 4
- switch (ch)
- {
- case 1: if (D[i].BGN > 0)
- {
- D[i].BGN = D[i].BGN - D[i].BGN;
- system("cls");
- cout << "|-------------------------------------------|" << endl;
- cout << "| Transaction was successful |" << endl;
- cout << "| Your balance is " << D[i].BGN << " lv |" << endl;
- cout << "| Your account was successfully shut down |" << endl;
- cout << "|-------------------------------------------|" << endl;
- // Занулява парите в акаунта
- }
- else if (D[i].USD > 0)
- {
- D[i].USD = D[i].USD - D[i].USD;
- system("cls");
- cout << "|-------------------------------------------|" << endl;
- cout << "| Transaction was successful |" << endl;
- cout << "| Your balance is " << D[i].USD << " USD |" << endl;
- cout << "| Your account was successfully shut down |" << endl;
- cout << "|-------------------------------------------|" << endl;
- // Занулява парите в акаунта
- }
- else if (D[i].EUR > 0)
- {
- D[i].EUR = D[i].EUR - D[i].EUR;
- system("cls");
- cout << "|-------------------------------------------|" << endl;
- cout << "| Transaction was successful |" << endl;
- cout << "| Your balance is " << D[i].EUR << " EUR |" << endl;
- cout << "| Your account was successfully shut down |" << endl;
- cout << "|-------------------------------------------|" << endl;
- // Занулява парите в акаунта
- }
- D[i].acc_no = 0;
- break;// Номера на акунта става нула
- case 2: if (D[i].BGN > 0)
- {
- cout << "\n How much you want to withdraw :";
- cin >> wdraw;// Избира се колко пари да се извадят от акаунта
- D[i].BGN = D[i].BGN - wdraw;// След като се зададът колко пари да се изкарат от акаунта се задава новата сума
- if (wdraw > D[i].BGN)
- {
- system("cls");
- cout << "|------------------------------------------------|" << endl;
- cout << "| You can't withdraw more money than you deposit |" << endl;
- cout << "|------------------------------------------------|" << endl;
- break;
- }
- else
- {
- system("cls");
- cout << "|-------------------------------------------|" << endl;
- cout << "| Transaction was successful |" << endl;
- cout << "| Your balance is " << D[i].BGN << " BGN |" << endl;
- cout << "|-------------------------------------------|" << endl;
- break;
- }
- }
- else if (D[i].BGN < 1)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| You haven't deposit with this value yet |" << endl;
- cout << "|-----------------------------------------|" << endl;
- break;
- }
- case 3:
- if (D[i].USD > 0)
- {
- cout << "\n How much you want to withdraw :";
- cin >> wdraw;// Избира се колко пари да се извадят от акаунта
- D[i].USD = D[i].USD - wdraw;// След като се зададът колко пари да се изкарат от акаунта се задава новата сума
- if (wdraw > D[i].BGN)
- {
- system("cls");
- cout << "|------------------------------------------------|" << endl;
- cout << "| You can't withdraw more money than you deposit |" << endl;
- cout << "|------------------------------------------------|" << endl;
- break;
- }
- else
- {
- system("cls");
- cout << "|-------------------------------------------|" << endl;
- cout << "| Transaction was successful |" << endl;
- cout << "| Your balance is " << D[i].USD << " USD |" << endl;
- cout << "|-------------------------------------------|" << endl;
- break;
- }
- }
- else if (D[i].USD < 1)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| You haven't deposit with this value yet |" << endl;
- cout << "|-----------------------------------------|" << endl;
- break;
- }
- case 4:
- if (D[i].EUR > 0)
- {
- cout << "\n How much you want to withdraw :";
- cin >> wdraw;// Избира се колко пари да се извадят от акаунта
- D[i].EUR = D[i].EUR - wdraw;// След като се зададът колко пари да се изкарат от акаунта се задава новата сума
- if (wdraw > D[i].BGN)
- {
- system("cls");
- cout << "|------------------------------------------------|" << endl;
- cout << "| You can't withdraw more money than you deposit |" << endl;
- cout << "|------------------------------------------------|" << endl;
- break;
- }
- else
- {
- system("cls");
- cout << "|-------------------------------------------|" << endl;
- cout << "| Transaction was successful |" << endl;
- cout << "| Your balance is " << D[i].EUR << " EUR |" << endl;
- cout << "|-------------------------------------------|" << endl;
- break;
- }
- }
- else if (D[i].EUR < 1)
- {
- system("cls");
- cout << "|-----------------------------------------|" << endl;
- cout << "| You haven't deposit with this value yet |" << endl;
- cout << "|-----------------------------------------|" << endl;
- break;
- }
- }
- } while (ch < 1 || ch >4);
- }
- }
- }
- }
- void WriteToBinary(bank* D, int& depositorCount)
- {
- fstream file("Depositor(s).bin", ios::binary | ios::out);
- if (!file)
- {
- cout << "error while opening this file";
- }
- file.write((char*)D, sizeof(bank) * depositorCount);
- file.close();
- system("cls");
- cout << "|--------------------------------------------|" << endl;
- cout << "| Depositor(s) data was successfully saved ! |" << endl;
- cout << "|--------------------------------------------|" << endl << endl;
- }
- // Запис в двоичен файл
- int readBinary(bank* D)
- {
- long pos;
- int n = 0, i; bank b;
- fstream file;
- file.open("Depositor(s).bin", ios::binary | ios::in);
- if (!file)
- {
- cout << "\n file not exist\n";
- return n;
- }
- file.seekg(0l, ios::end);
- pos = file.tellg();
- file.close();
- n = pos / (sizeof(bank));
- file.open("Depositor(s).bin", ios::binary | ios::in);
- if (!file) { cout << "\n Error in file \n"; exit(1); }
- for (i = 0; i < n; i++)
- {
- file.read((char*)&b, sizeof(bank));
- D[i] = b;
- }
- file.close();
- return n;
- }
- // Четене на двоичен файл
- void sort(bank* D, int& depositorCount)
- {
- if (depositorCount < 1)
- {
- system("cls");
- cout << "|-------------------------------------------------------------|" << endl;
- cout << "| There are not depositors added yet ! |" << endl;
- cout << "| You can add some buy choose the option in main menu 1 or 2. |" << endl;
- cout << "|-------------------------------------------------------------|" << endl << endl;
- }
- else if (depositorCount > 0)
- {
- system("cls");
- cout << "|--------------------------------------------------------------|" << endl;
- cout << "| SORT PROFILES: CREATING ACCOUNG DATE AND MONEY DEPOSIT |" << endl;
- cout << "|--------------------------------------------------------------|" << endl;
- for (int i = 0; i < depositorCount; i++)
- {
- for (int j = i + 1; j < depositorCount; j++)
- {
- if (D[i].year > D[j].year)
- {
- struct bank temp = D[i];
- D[i] = D[j];
- D[j] = temp;
- }
- else if (D[i].year == D[j].year && D[i].month > D[j].month)
- {
- struct bank temp = D[i];
- D[i] = D[j];
- D[j] = temp;
- }
- else if (D[i].year == D[j].year && D[i].month == D[j].month && D[i].day > D[j].day)
- {
- struct bank temp = D[i];
- D[i] = D[j];
- D[j] = temp;
- }
- }
- }
- // Сортировка на датите
- cout << "Accounts deleted:" << endl;
- for (int i = 0; i < depositorCount; i++)
- {
- if (D[i].acc_no == 0)
- {
- cout << D[i].name << endl;
- cout << "No deposits, account shutted down" << endl;
- }
- }// Показва изтрите акаунти
- cout << endl << "Active accounts:" << endl;
- for (int i = 0; i < depositorCount; i++)
- {
- if (D[i].acc_no != 0)
- {
- cout << endl;
- cout << "ACCOUNT NUMBER: " << D[i].acc_no << endl; // Изписва номер на акунта
- cout << "ACCOUNT NAME: " << D[i].name << endl; // Изписва името на акаунта
- cout << "Created on date: " << D[i].day << "." << D[i].month << "." << D[i].year << endl; // Изписва датата на която е създаден акаунта
- if (D[i].BGN < 1)
- {
- cout << "MONEY DEPOSIT: 0 lv" << endl;
- }
- else if (D[i].BGN > 0)
- {
- cout << "MONEY DEPOSIT: " << D[i].BGN << " lv" << endl; // Изписва парите които са вкарани вътре
- }
- if (D[i].USD < 1)
- {
- cout << "MONEY DEPOSIT: 0 USD" << endl;
- }
- else if (D[i].USD > 0)
- {
- cout << "MONEY DEPOSIT: " << D[i].USD << " USD" << endl;// Изписва парите които са вкарани вътре
- }
- if (D[i].EUR < 1)
- {
- cout << "MONEY DEPOSIT: 0 EUR" << endl;
- }
- else if (D[i].EUR > 0)
- {
- cout << "MONEY DEPOSIT: " << D[i].EUR << " EUR" << endl << endl;// Изписва парите които са вкарани вътре
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment