Mavzu: q аndоlаt mахsulоtlаri ishlаb chiqаrish
Foydalanilgan adabiyotlar
Download 0.72 Mb. Pdf ko'rish
|
loyha dastur 1
- Bu sahifa navigatsiya:
- ILOVA. Dasturning ko’d qismi
Foydalanilgan adabiyotlar
1. B.B Mo’minov “Dasturlash I” 2. Qudrat Abduraxmonov “C++ dasturlash tili” Internet manbalari: 1. www.cyber-form.ru 2. www.wikipedia.org 3. www.programmer.com 4. W3schools.com 5. Tutorial.com 6. Edx.org.com ILOVA. Dasturning ko’d qismi #include #include #include #include #include #include using namespace std; void Show_Date() { time_t now = time(0); struct tm * timeinfo = localtime(&now); cout << "\t" << timeinfo->tm_mday << "." << timeinfo->tm_mon + 1 << "." << 1900 + timeinfo->tm_year << "\n"; } int stoi(string text) { stringstream conv(text); int x; conv >> x; return x; } void Show_Employees(){ ifstream efile("employees.txt"); string line; if (!getline(efile, line) || !efile) cout << "Ma'lumot mavjud emas"; else { cout << line << "\n"; while(getline(efile, line)){ cout << line << "\n"; } } efile.close(); } void Add_New() { cout << "\ t Yangi pishirig'lar \n"; cout << " Pishirig'lar turlari : "; string name; cin.ignore(); getline(cin, name); cout << "\n!!! Ogohlantirish !!!\n"; cout << "*Yangi pishirig'lar qo'shilganda jadval qayta tuziladi.\n\n"; cout << "Yangi pishirig' qo'shilsinmi? (1-Ha, 2-yo'q)\n"; int n; cin >> n; if (n == 2) { cout << "Bekor qilindi!\n"; return; } ofstream efile("employees.txt", ios::app); string line; if (!efile){ cout << "Xatolik 404\n"; return; } efile << name << endl; cout << "Muvaffaqiyatli qo'shildi!\n"; efile.close(); } void Update() { ifstream file("last.txt"); ifstream efile("employees.txt"); ofstream lfile("log.txt", ios::app); string line; getline(file, line); file.close(); int month = stoi(line.substr(0,2)); string syear = line.substr(2,4); int year = stoi(syear); string current = line.erase(0,6); time_t now = time(0); struct tm * timeinfo = localtime(&now); timeinfo->tm_year += 1900; ostringstream text; if ((year < timeinfo->tm_year) || (timeinfo->tm_mon > month)) { while (getline(efile, line) && (line != current)) {cout<<"inwhile\n";} for (int i = 1; i <= (timeinfo->tm_mon - month); i++) { cout << "infor\n"; getline(efile, line); month += 1; string t; if (month < 10) { text << month; lfile << "0" << text.str() << syear << line << endl; } else lfile << text.str() << syear << line << endl; } ofstream rfile("last.txt"); if (month < 10) { //text << month; rfile << "0" << text.str() << syear << line << endl; cout << "0" << text.str() < else rfile << text.str() << syear << line << endl; } file.close(); efile.close(); lfile.close(); } string Get_Last() { ifstream file("last.txt"); string linee; if (!getline(file, linee)) return "Ma'lumot mavjud emas"; else { linee.erase(linee.begin(),linee.begin()+6); return linee; } file.close(); } string Month(int mon) { if (mon == 0) return 0; } void Xodimlar() { ifstream file("log.txt"); string line; if (!getline(file, line) || !file) cout << "Ma'lumot mavjud emas"; else { int month = stoi(line.substr(0,2)); int year = stoi(line.substr(2,7)); line.erase(0,6); cout << line < int month = stoi(line.substr(0,2)); int year = stoi(line.substr(2,7)); line.erase(0,6); cout << line << endl ; } } file.close(); } void Future() { ifstream efile("employees.txt"); ifstream lfile("last.txt"); string line; getline(lfile, line); int month = stoi(line.substr(0,2)); int year = stoi(line.substr(2,7)); string current = line.erase(0,6); bool show = false; while (getline(efile, line)) { if (line == current) { show = true; getline(efile, line); } if (show) { if (month == 11) { month = -1; year += 1; } month += 1; cout << line << "\t- " << Month(month) << " " << year << "-yil\n"; } } if (!show) cout << "Ma'lumot mavjud emas\n"; efile.close(); lfile.close(); } int main(int argc, char** argv) { Update(); main: system("cls"); cout << "\t Pishirig' do'koni nomi : "; cout<<" SHIRIN QANDOLAT"< cout << "\n1. Pishishirig'lar jadvali\n"; cout << "2.yangi mahsulotlar ro'yhati\n"; cout << "3.Yangi pishirig'lar qo'shish\n"; cout << "4.Dasturdan chiqish\n"; cout << "Bo'limni tanllang : " ; int num; cin >> num; if (num == 2) { system("cls"); cout << "\t Yangi pishirig'lar\n"; Show_Employees(); cout << "\n*Qaytish -1-\n"; cin >> num; goto main; } else if (num == 3) { system("cls"); Add_New(); cout << "\n*Qaytish -1-\n"; cin >> num; goto main; } else if (num == 1) { system("cls"); cout << "\t yangi mahsulotlar ro'yhati:\n"; Xodimlar(); cout << "\n*Qaytish -1-\n"; cin >> num; goto main; } return 0;} Download 0.72 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling