Advertisement
Guest User

Untitled

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