Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save XoLinA/2a09a78f1d8697e0db7ab89f0fd54a8f to your computer and use it in GitHub Desktop.

Select an option

Save XoLinA/2a09a78f1d8697e0db7ab89f0fd54a8f to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <Windows.h>
using namespace std;
int main()
{
const char* html = "C:/Users/Me/Desktop/file.html";
ifstream file(html);
if (!file.is_open())
{
cout << "Not found///////////";
return 0;
}
char ch;
char prev = '\0';
int openB = 0;
int closeB = 0;
while (file.get(ch))
{
if (ch == '<' && prev == '<')
{
cout << "Error/// <<";
return 0;
}
if (ch == '>' && prev == '>')
{
cout << "Error/// >>";
return 0;
}
if (ch == '<')
{
openB++;
}
if (ch == '>')
{
if (closeB + 1 > openB)
{
cout << "Error/// > without <";
return 0;
}
closeB++;
}
prev = ch;
}
if (openB != closeB)
{
cout << "Error/// not enough >";
}
else
{
cout << "GOOD!*************************************************";
}
file.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment