Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void main()
- {
- char a;
- int open(0), close(0);
- ifstream f("text.txt", ios::in);
- if (f)
- {
- while (f)
- {
- f.get(a);
- if (a == '(')
- open++;
- if (a == ')')
- close++;
- a = ' ';
- }
- cout << "( = " << open << "\n) = " << close << "\n";
- if (open == close)
- cout << "Correct code\n";
- else
- cout << "Uncorrect code\n";
- }
- else cout << "Error input file\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement