-qadam → Bosh menyuga 2 raqamini kiritamiz. Bu yerda
Pishirig’lar ro’yhati keltirilgan
4-qadam
səhifə 3/3 tarix 05.06.2023 ölçüsü 0,87 Mb. #125008
loyha dastur 1
3-qadam → Bosh menyuga 2 raqamini kiritamiz. Bu yerda
Pishirig’lar ro’yhati keltirilgan
4-qadam → Consul oynasiga 3 raqamini kiritamiz va yangi maxsulot qo’shish bo’lim i ishga tushadi. Bu yerda ham bir necha shartlar orqali yangi maxsulot qo’shishimiz mumkin
5-qadam → Eng oxirida esa 4 ni kiritamiz va dasturdan chiqish bo’limini tanlaymiz.
XULOSA
Xulosa o'rnida shuni aytmoqchimanki , dastur va dasturlash hozirda inson hayotining ajralmas qismiga ajralib bo'lgan. Shuning uchun dasturlash sohasini chuqur o'rganish kerak ekanligini angladim.Dasturlash tillarini o'rganish esa bundan ham kerakli va qiziqarlidir. Umuman olganda dasturlash inson hayotini va u bajaradigan mehnatni maksimal darajada osonlashtiradi. Dasturni optimallash esa yozilgan dasturni eng yaxshi ,eng qisqa, eng maqbuk variantga keltirishdir.Bu esa izga juda ulkan imkoniyatlar beradi.
Foydalanilgan adabiyotlar
B.B Mo’minov “Dasturlash I”
Qudrat Abduraxmonov “C++ dasturlash tili”
Internet manbalari:
www.cyber-form.ru
www.wikipedia.org
www.programmer.com
W3schools.com
Tutorial.com
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 < while (getline(file, 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 << " SOTUVCHI : " <<" Asilaxon "<< endl;
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;} Dostları ilə paylaş: