Advertisement
Guest User

Untitled

a guest
May 12th, 2020
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <conio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <iomanip>
  7. #include <windows.h>
  8. using namespace std;
  9.  
  10. void gotoxy(int x, int y)
  11. {
  12. static HANDLE h = NULL;
  13. if(!h)
  14. h = GetStdHandle(STD_OUTPUT_HANDLE);
  15. COORD c = { x, y };
  16. SetConsoleCursorPosition(h,c);
  17. }
  18.  
  19. class CObopud
  20. {
  21.  
  22. char code[9];
  23. char name[15];
  24. int colvo;
  25. int dis_name;
  26. int cost;
  27. char data [10];
  28. public:
  29. CObopud (char*,char*,int,int,int,char*);
  30. void input();
  31. void output();
  32. void document();
  33. void out_code();
  34. int max_pr();
  35. #define windows 1
  36.  
  37. void console_clear_screen() {
  38. #ifdef WINDOWS
  39. system("cls");
  40. #endif
  41. #ifdef LINUX
  42. system("clear");
  43. #endif
  44. }
  45. };
  46. CObopud::CObopud(char* cd,char* nm,int cl,int dn,int cs,char* dt)
  47. {
  48. strcpy(data,dt);
  49. cost=cs;
  50. strcpy(name,nm);
  51. dis_name=dn;
  52. colvo=cl;
  53. strcpy(cd,code);
  54.  
  55. }
  56. #define windows 1
  57.  
  58. void console_clear_screen() {
  59. #ifdef WINDOWS
  60. system("cls");
  61. #endif
  62. #ifdef LINUX
  63. system("clear");
  64. #endif
  65. }
  66. void CObopud::input()
  67. {
  68. system("cls");
  69.  
  70. ofstream fprost("prostoy.dat",ios::app);
  71. system("cls");
  72. cout<<"Code postachalnyka: "; cin>>code;
  73. cout<<"Name of Postachalnyk: "; cin>>dis_name;
  74. cout<<"Name of Towar: "; cin>>name;
  75. cout<<"Number of shift: "; cin>>colvo;
  76. cout<<"Cina: "; cin>>cost;
  77. cout<<"Data Postavky: "; cin>>data;
  78.  
  79.  
  80.  
  81. fprost<<code<<' '<<' '<<dis_name<<' '<<name<<' '<<colvo<<' '<<cost<<' '<<data<<endl;
  82. }
  83. void CObopud::output()
  84. {
  85. ifstream fprost("prostoy.dat");
  86. system("cls");
  87. cout<<"__________________________________________________"<<endl;
  88. cout<<"Code postachalnyka "<<"Name of Postachalnyk "<<"Name of Towar "<<"Number of shift "<<"Cina "<<"Data Postavky "<<endl;
  89. cout<<"_______________________________________________________________________________________________________________"<<endl;
  90. cout<<endl;
  91. while (fprost>>code>>dis_name>>name>>colvo>>cost>>data)
  92. {
  93. cout<<setiosflags(ios::left)<<setw(26)<<code;
  94. cout<<setw(25) <<dis_name<<setw(10);
  95. cout<<name<<setiosflags(ios::right)<<setw(8);;
  96. cout<<setiosflags(ios::left)<<setw(12)<<colvo;
  97. cout<<setw(20) <<cost<<setw(6);
  98. cout<<data<<endl;
  99. }
  100. cout<<"_______________________________________________________________________________________________________________"<<endl;
  101. }
  102. void CObopud::document()
  103. {
  104. int sum=0;
  105. ifstream fprost("prostoy.dat");
  106. system("cls");
  107.  
  108. cout<<"_____________________________________"<<endl;
  109. cout<<"Stuff"<<" Downtime"<<endl;
  110. cout<<"_____________________________________"<<endl;
  111. while (fprost>>code>>dis_name>>name>>colvo>>cost>>data)
  112. {
  113. cout<<setiosflags(ios::left)<<setw(20)<<name<<setw(10)
  114. <<setiosflags(ios::right)<<setw(8)<<data<<endl;
  115. sum+=cost;
  116. }
  117. cout<<"_____________________________________"<<endl;
  118. cout<<"Total:"<<setw(22)<<setiosflags(ios::right)<<sum;
  119. }
  120. void CObopud::out_code()
  121. {
  122. ifstream fprost("prostoy.dat");
  123. char vvcode[9];
  124. system("cls");
  125. cout<<"Enter Code postachalnyka: ";
  126. cin>>vvcode;
  127. cout<<" Report for ";
  128. cout<<vvcode<<endl;
  129. cout<<"__________________________________________"<<endl;
  130. cout<<"Stuff "<<"Change number"<<"Downtime"<<endl;
  131. cout<<"________________________________________"<<endl;
  132. cout<<endl;
  133. while (fprost>>code>>dis_name>>name>>colvo>>cost>>data) {
  134. if(strcmp(vvcode,code)==0)
  135. cout<<setiosflags(ios::left)<<setw(20) <<name<<setw(10)
  136. <<colvo<<setiosflags(ios::right)<<setw(8)<<data<<endl;
  137. }
  138. cout<<"_________________________________________"<<endl;
  139. }
  140.  
  141. int main()
  142. {
  143. int nr;
  144. CObopud Obopud("","",0,0);
  145. for (;;) {
  146. system("cls");
  147. gotoxy (20,7); cout<<"MENU";
  148. gotoxy (10,9); cout<<"1. Enter downtime code ";
  149. gotoxy (10,10); cout<<"2. View downtime code ";
  150. gotoxy (10,11); cout<<"3. Source document";
  151. gotoxy (10,12); cout<<"4. Information by Code postachalnyka";
  152. gotoxy (10,13); cout<< "5. Maximum downtime";
  153. gotoxy (10,14); cout<< "5. Exit";
  154. gotoxy (10,15); cout<<" Specify the mode: ";
  155. gotoxy (30,15); cin>>nr;
  156. switch(nr) {
  157. case 1: Obopud.input(); break;
  158. case 2: Obopud.output(); getch(); break;
  159. case 3: Obopud.document(); getch();break;
  160. case 4: Obopud.out_code(); getch(); break;
  161. getch(); break;
  162. case 5: exit (1);
  163. }
  164. }
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement