Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
2.0 kB
6
Indexable
Never
#include <bits/stdc++.h>
using namespace std;
string a[100][4];
int sk = 0;
void Sua()
{
	string x;
	bool check = false;
	cout << "Nhap ten su kien can chinh sua: "; getline(cin,x);
	for (int i=0; i<sk; i++)
		{
			if (x.compare(a[i][1]) == 0)
			{
				cout << "Nhap ngay dien ra: "; getline(cin,a[i][0]);
				cout << "Nhap ten su kien: "; getline(cin,a[i][1]);
				cout << "Nhap noi dung su kien: "; getline(cin,a[i][2]);
				cout << "Nhap dia diem su kien: "; getline(cin,a[i][3]);
				cout << "Nhap hop dong su kien: "; getline(cin,a[i][4]);
				check = true;
				break;
			}
		}
	if (check == true) cout <<"Thuc hien sua doi thanh cong. \n";
	else cout << "Khong tim thay su kien nay.\n";
}
void Nhap()
{
	cout << "Nhap ngay dien ra: "; getline(cin,a[sk][0]);
	cout << "Nhap ten su kien: "; getline(cin,a[sk][1]);
	cout << "Nhap noi dung su kien: "; getline(cin,a[sk][2]);
	cout << "Nhap dia diem su kien: "; getline(cin,a[sk][3]);
	cout << "Nhap hop dong su kien: "; getline(cin,a[sk][4]);
	sk++;
}
void In()
{
	for (int i=0; i<sk; i++){
			cout << "Ngay dien ra: "<< a[i][0] << endl;
			cout << "Ten su kien: "<< a[i][1] << endl;
			cout << "Noi dung su kien: "<< a[i][2] << endl;
			cout << "Dia diem su kien: "<< a[i][3] << endl;
			cout << "Hop dong su kien: "<< a[i][4] << endl;
	}
}
void Menu()
{
	bool kt_menu = true;
	while(kt_menu)
	{
		system("cls");
		cout << "\t\t=====Quan li KOL=====\n";
		cout << "\t\t1.Hien thi\n";
		cout << "\t\t2.Them\n";
		cout << "\t\t3.Sua\n";
		cout << "\t\t4.Xoa\n";
		cout << "\t\t0.Thoat\n";
		int lc;
		cout << "\nChon chuc nang: ";
		cin >> lc;
		cin.ignore();
		switch(lc)
		{
			case 1:
			{
				In();
				system("pause");
				break;
			}
			case 2:
			{
				Nhap();
				break;
			}
			case 3:
			{
				Sua();
				break;
			}
			case 0:
			{
				kt_menu = false;
				break;
			}
		}
	}
}
int main()
{
	Menu();
}