Advertisement
Guest User

Untitled

a guest
May 27th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.24 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <fstream>
  4. #include <string>
  5. #include <vector>
  6. #include <Windows.h>
  7. using namespace std;
  8. COORD scrn;
  9. HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
  10. int main() {
  11.     HDC hDC = GetDC(GetConsoleWindow());
  12.     ifstream FirstFile("FirstFile.txt");
  13.     ofstream CheckingFile("CheckingFile.ann");
  14.     ifstream Draw("CheckingFile.ann");
  15.     string Line;
  16.     int CountLine=0;
  17.     int CountErrorLine=0;
  18.     int Cout8=0;
  19.     while (getline(FirstFile, Line)){
  20.         CountLine++;
  21.         for(int i=0;i<Line.size();i++){
  22.             if((! ((Line[i]>='0')&&(Line[i]<='9')))&& (! (Line[i]==' ')) ){
  23.                 Line.erase(i,1);
  24.                 i--;
  25.             }
  26.         }
  27.         if( (Line.size()==8)&&((Line[0]>='0')&&(Line[0]<='9'))&& ((Line[1]>='0')&&(Line[1]<='9'))&&(Line[2]==' ')&&((Line[3]>='0')&&(Line[3]<='9'))&& ((Line[4]>='0')&&(Line[4]<='9'))&&(Line[5]==' ')&&((Line[6]>='0')&&(Line[6]<='9'))&& ((Line[7]>='0')&&(Line[7]<='9'))&&(Line[0]<Line[3])){
  28.             CheckingFile<<Line<<endl;
  29.             if((Line[0]=='8')||(Line[3]=='8'))Cout8=1;
  30.         }
  31.         else{
  32.             cout<<"Error"<<" ("<<CountLine<<") "<<Line<<endl;
  33.             CountErrorLine++;
  34.         }
  35.     }
  36.     if(Cout8==0)cout<<"There is no acceptor at the 8"<<endl;
  37.     CountLine=CountLine-CountErrorLine;
  38.     HPEN Pen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
  39.     SelectObject(hDC, Pen);
  40.     HBRUSH Brush = CreateSolidBrush(RGB(0, 0, 255));
  41.     SelectObject(hDC, Brush);
  42.     int z = 80;
  43.     for (int i = 0; i < 8; i++){
  44.         MoveToEx(hDC, 0, z, NULL);
  45.         LineTo(hDC, 360, z);
  46.         z = z + 40;
  47.     }
  48.     Pen = CreatePen(PS_SOLID, 1, RGB(0, 255, 0));
  49.     SelectObject(hDC, Pen);
  50.     while (getline(Draw, Line)){
  51.         Ellipse(hDC, (Line[1]- 0x30)*40-5, 420-(Line[0]- 0x30)*40-5, (Line[1]- 0x30)*40-35, 420-(Line[0]- 0x30)*40-35);
  52.         Ellipse(hDC, (Line[4]- 0x30)*40-5, 420-(Line[3]- 0x30)*40-5, (Line[4]- 0x30)*40-35, 420-(Line[3]- 0x30)*40-35);
  53.         MoveToEx(hDC, (Line[1]- 0x30)*40-20, 420-(Line[0]- 0x30)*40-35, NULL);
  54.         LineTo(hDC, (Line[4]- 0x30)*40-20,420-(Line[3]- 0x30)*40-5);
  55.     }
  56.     FirstFile.close();
  57.     CheckingFile.close();
  58.     Draw.close();
  59.     system("pause");
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement