Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <fstream>
- #include <string>
- #include <vector>
- #include <Windows.h>
- using namespace std;
- COORD scrn;
- HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
- int main() {
- HDC hDC = GetDC(GetConsoleWindow());
- ifstream FirstFile("FirstFile.txt");
- ofstream CheckingFile("CheckingFile.ann");
- ifstream Draw("CheckingFile.ann");
- string Line;
- int CountLine=0;
- int CountErrorLine=0;
- int Cout8=0;
- while (getline(FirstFile, Line)){
- CountLine++;
- for(int i=0;i<Line.size();i++){
- if((! ((Line[i]>='0')&&(Line[i]<='9')))&& (! (Line[i]==' ')) ){
- Line.erase(i,1);
- i--;
- }
- }
- 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])){
- CheckingFile<<Line<<endl;
- if((Line[0]=='8')||(Line[3]=='8'))Cout8=1;
- }
- else{
- cout<<"Error"<<" ("<<CountLine<<") "<<Line<<endl;
- CountErrorLine++;
- }
- }
- if(Cout8==0)cout<<"There is no acceptor at the 8"<<endl;
- CountLine=CountLine-CountErrorLine;
- HPEN Pen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
- SelectObject(hDC, Pen);
- HBRUSH Brush = CreateSolidBrush(RGB(0, 0, 255));
- SelectObject(hDC, Brush);
- int z = 80;
- for (int i = 0; i < 8; i++){
- MoveToEx(hDC, 0, z, NULL);
- LineTo(hDC, 360, z);
- z = z + 40;
- }
- Pen = CreatePen(PS_SOLID, 1, RGB(0, 255, 0));
- SelectObject(hDC, Pen);
- while (getline(Draw, Line)){
- Ellipse(hDC, (Line[1]- 0x30)*40-5, 420-(Line[0]- 0x30)*40-5, (Line[1]- 0x30)*40-35, 420-(Line[0]- 0x30)*40-35);
- Ellipse(hDC, (Line[4]- 0x30)*40-5, 420-(Line[3]- 0x30)*40-5, (Line[4]- 0x30)*40-35, 420-(Line[3]- 0x30)*40-35);
- MoveToEx(hDC, (Line[1]- 0x30)*40-20, 420-(Line[0]- 0x30)*40-35, NULL);
- LineTo(hDC, (Line[4]- 0x30)*40-20,420-(Line[3]- 0x30)*40-5);
- }
- FirstFile.close();
- CheckingFile.close();
- Draw.close();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement