Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- #include <Windows.h>
- # define str_len 50
- # define size 10
- int choice;
- using namespace std;
- struct Custumer
- {
- char name[str_len];
- int account_number;
- int sum_on_account;
- unsigned short m : 4;
- unsigned short d : 4;
- unsigned short h : 4;
- unsigned short g : 7;
- };
- enum { preferential=1, urgent }type_account;
- struct Custumer list_of_custumers[size];
- Custumer bad;
- int current_size = 0;
- int month;
- int day;
- int hour;
- int type;
- int god;
- void enter_new()
- {
- setlocale(LC_CTYPE, "Russian");
- cout << "Ввод информации " << endl;
- if (current_size < size)
- {
- cout << "Строка номер ";
- cout << current_size + 1;
- cout << endl << "Ф.И.О " << endl;
- cin >> list_of_custumers[current_size].name;
- cout << "Номер счета " << endl;
- cin >> list_of_custumers[current_size].account_number;
- cout << "Тип счета(1-preferential,2-urgent) " << endl;
- cin >> type;
- if (type == 1) {
- type_account = preferential; cout << "preferential" << endl;
- }
- else if (type == 2) {
- type_account = urgent; cout << "urgent" << endl;
- }
- cout << "Сумма на счете" << endl;
- cin >> list_of_custumers[current_size].sum_on_account;
- cout << "Дата изменения" << endl;
- cout << "Год: " << endl; cin >> month; list_of_custumers[current_size].g = god;
- cout << "Месяц: " << endl; cin >> month; list_of_custumers[current_size].m = month;
- cout << "День: " << endl; cin >> day; list_of_custumers[current_size].d =day;
- cout << "Час: " << endl; cin >> hour; list_of_custumers[current_size].h = hour;
- current_size++;
- }
- else cout << "Введено максимальное кол-во строк ";
- cout << "Что дальше? " << endl;
- cin >> choice;
- }
- void del()
- {
- setlocale(LC_CTYPE, "Russian");
- int d;
- cout << "\nНомер строки, которую надо удалить (для удаления всех строк нажать 99) " << endl;
- cin >> d;
- if (d != 99)
- {
- for (int de1 = (d - 1); de1 < current_size; de1++)
- list_of_custumers[de1] = list_of_custumers[de1 + 1];
- current_size = current_size - 1;
- }
- if (d == 99)
- for (int i = 0; i < size; i++)
- list_of_custumers[i] = bad;
- cout << "Что дальше?" << endl;
- cin >> choice;
- }
- void change()
- {
- int n, per,k;
- cout << "\nВведите номер строки" << endl;
- cin >> n;
- do
- {
- cout << "Введите: " << endl;
- cout << "1-Для изменения Ф.И.О" << endl;
- cout << "2-Для изменения номера счета" << endl;
- cout << "3-Для изменения типа счета" << endl;
- cout << "4-Для изменения суммы счета" << endl;
- cout << "5-Для изменения новая дата" << endl;
- cout << "6-конец\n"; cin >> per;
- switch (per)
- {
- case 1: cout << "Новое Ф.И.О";
- cin >> list_of_custumers[n - 1].name;
- break;
- case 2: cout << "Новый номер счета";
- cin >> list_of_custumers[n - 1].account_number;
- break;
- case 3: cout << "Новый тип счета"; cin >> k; k = type_account;
- break;
- case 4: cout << "Новая сумма"; cin >> list_of_custumers[n - 1].sum_on_account;
- break;
- case 5: cout << "Новая дата изменения"; /*cin >> list_of_custumers[n - 1].;*/
- break;
- }
- } while (per != 6);
- cout << "Что дальше?" << endl;
- cin >> choice;
- }
- void out()
- {
- setlocale(LC_CTYPE, "Russian");
- int sw, n, u;
- cout << "1-вывод по номеру" << endl;
- cout << "2-вывод по сумме в диапазоне" << endl;
- cin >> sw;
- if (sw == 1)
- {
- cout << "Введите номер счета" << endl;
- cin >> n;
- for (int i = 0; i < size; i++)
- {
- if (n == list_of_custumers[i].account_number)
- {
- cout << "Ф.И.О " << endl;;
- cout << list_of_custumers[i].name << endl;
- cout << "Номер счета " << endl;
- cout << list_of_custumers[i].account_number << endl;
- cout << "Тип счета " << endl;
- cout << "Тип счета(1-preferential,2-urgent) " << endl;
- if (type == 1) {
- type_account = preferential; cout << "preferential" << endl;
- }
- else if (type == 2) {
- type_account = urgent; cout << "urgent" << endl;
- }
- cout << "Сумма на счете " << endl;
- cout << list_of_custumers[i].sum_on_account << endl;
- cout << "Дата именения " << endl;
- cout << "Месяц: " << month << endl;
- cout << "День: " << day << endl;
- cout << "Час: " << hour << endl;
- }
- }
- }
- if (sw == 2)
- {
- cout << "Счета где сумма больше 100" << endl;
- for (int i = 0; i < size; i++)
- {
- if (list_of_custumers[i].sum_on_account >= 100)
- {
- cout << "Ф.И.О ";
- cout << list_of_custumers[i].name << endl;
- cout << "Номер счета " << endl;
- cout << list_of_custumers[i].account_number << endl;
- cout << "Тип счета " << endl;
- if (type == 1) {
- type_account = preferential; cout << "preferential" << endl;
- }
- else if (type == 2) {
- type_account = urgent; cout << "urgent" << endl;
- }
- cout << "Сумма на счете " << endl;
- cout << list_of_custumers[i].sum_on_account << endl;
- cout << "Дата именения " << endl;
- cout << "Месяц: " << month<< endl;
- cout << "День: "<< day<< endl;
- cout << "Час: " << hour<< endl;
- }
- }
- cout << "Что дальше?" << endl; cin >> choice;
- }
- }
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- setlocale(LC_CTYPE, "Russian");
- cout << "Введите:" << endl;
- cout << "1-для удаления записи" << endl;
- cout << "2-для ввода новой записи" << endl;
- cout << "3-для изменения записи" << endl;
- cout << "4-для вывода записи(ей)" << endl;
- cout << "5-для выхода" << endl;
- cin >> choice;
- do
- {
- switch (choice)
- {
- case 1: del();
- break;
- case 2: enter_new();
- break;
- case 3: change();
- break;
- case 4: out();
- break;
- }
- } while (choice != 5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement