Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <conio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <iomanip>
- #include <windows.h>
- using namespace std;
- void gotoxy(int x, int y)
- {
- static HANDLE h = NULL;
- if(!h)
- h = GetStdHandle(STD_OUTPUT_HANDLE);
- COORD c = { x, y };
- SetConsoleCursorPosition(h,c);
- }
- class CObopud
- {
- char code[9];
- char name[15];
- int colvo;
- int dis_name;
- int cost;
- char data [10];
- public:
- CObopud (char*,char*,int,int,int,char*);
- void input();
- void output();
- void document();
- void out_code();
- int max_pr();
- #define windows 1
- void console_clear_screen() {
- #ifdef WINDOWS
- system("cls");
- #endif
- #ifdef LINUX
- system("clear");
- #endif
- }
- };
- CObopud::CObopud(char* cd,char* nm,int cl,int dn,int cs,char* dt)
- {
- strcpy(data,dt);
- cost=cs;
- strcpy(name,nm);
- dis_name=dn;
- colvo=cl;
- strcpy(cd,code);
- }
- #define windows 1
- void console_clear_screen() {
- #ifdef WINDOWS
- system("cls");
- #endif
- #ifdef LINUX
- system("clear");
- #endif
- }
- void CObopud::input()
- {
- system("cls");
- ofstream fprost("prostoy.dat",ios::app);
- system("cls");
- cout<<"Code postachalnyka: "; cin>>code;
- cout<<"Name of Postachalnyk: "; cin>>dis_name;
- cout<<"Name of Towar: "; cin>>name;
- cout<<"Number of shift: "; cin>>colvo;
- cout<<"Cina: "; cin>>cost;
- cout<<"Data Postavky: "; cin>>data;
- fprost<<code<<' '<<' '<<dis_name<<' '<<name<<' '<<colvo<<' '<<cost<<' '<<data<<endl;
- }
- void CObopud::output()
- {
- ifstream fprost("prostoy.dat");
- system("cls");
- cout<<"__________________________________________________"<<endl;
- cout<<"Code postachalnyka "<<"Name of Postachalnyk "<<"Name of Towar "<<"Number of shift "<<"Cina "<<"Data Postavky "<<endl;
- cout<<"_______________________________________________________________________________________________________________"<<endl;
- cout<<endl;
- while (fprost>>code>>dis_name>>name>>colvo>>cost>>data)
- {
- cout<<setiosflags(ios::left)<<setw(26)<<code;
- cout<<setw(25) <<dis_name<<setw(10);
- cout<<name<<setiosflags(ios::right)<<setw(8);;
- cout<<setiosflags(ios::left)<<setw(12)<<colvo;
- cout<<setw(20) <<cost<<setw(6);
- cout<<data<<endl;
- }
- cout<<"_______________________________________________________________________________________________________________"<<endl;
- }
- void CObopud::document()
- {
- int sum=0;
- ifstream fprost("prostoy.dat");
- system("cls");
- cout<<"_____________________________________"<<endl;
- cout<<"Stuff"<<" Downtime"<<endl;
- cout<<"_____________________________________"<<endl;
- while (fprost>>code>>dis_name>>name>>colvo>>cost>>data)
- {
- cout<<setiosflags(ios::left)<<setw(20)<<name<<setw(10)
- <<setiosflags(ios::right)<<setw(8)<<data<<endl;
- sum+=cost;
- }
- cout<<"_____________________________________"<<endl;
- cout<<"Total:"<<setw(22)<<setiosflags(ios::right)<<sum;
- }
- void CObopud::out_code()
- {
- ifstream fprost("prostoy.dat");
- char vvcode[9];
- system("cls");
- cout<<"Enter Code postachalnyka: ";
- cin>>vvcode;
- cout<<" Report for ";
- cout<<vvcode<<endl;
- cout<<"__________________________________________"<<endl;
- cout<<"Stuff "<<"Change number"<<"Downtime"<<endl;
- cout<<"________________________________________"<<endl;
- cout<<endl;
- while (fprost>>code>>dis_name>>name>>colvo>>cost>>data) {
- if(strcmp(vvcode,code)==0)
- cout<<setiosflags(ios::left)<<setw(20) <<name<<setw(10)
- <<colvo<<setiosflags(ios::right)<<setw(8)<<data<<endl;
- }
- cout<<"_________________________________________"<<endl;
- }
- int main()
- {
- int nr;
- CObopud Obopud("","",0,0);
- for (;;) {
- system("cls");
- gotoxy (20,7); cout<<"MENU";
- gotoxy (10,9); cout<<"1. Enter downtime code ";
- gotoxy (10,10); cout<<"2. View downtime code ";
- gotoxy (10,11); cout<<"3. Source document";
- gotoxy (10,12); cout<<"4. Information by Code postachalnyka";
- gotoxy (10,13); cout<< "5. Maximum downtime";
- gotoxy (10,14); cout<< "5. Exit";
- gotoxy (10,15); cout<<" Specify the mode: ";
- gotoxy (30,15); cin>>nr;
- switch(nr) {
- case 1: Obopud.input(); break;
- case 2: Obopud.output(); getch(); break;
- case 3: Obopud.document(); getch();break;
- case 4: Obopud.out_code(); getch(); break;
- getch(); break;
- case 5: exit (1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement