Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main(){
- char str[100];
- int i,o_b,c_b;// o_b - opening bracket; c_b - closing bracket.
- cout << "Input string, please:" << endl;
- cin >> str[100];
- o_b=c_b=0;
- for (i=0;i <=strlen(str);i++){
- if (str[i] == '(')
- o_b++;
- }
- for(i=0;i<=strlen(str);i++){
- if (str[i] == ')')
- c_b++;
- }
- if (o_b == c_b)
- cout << "the number of opening brackets and closing brackets are equal" << endl;
- else
- cout << "the number of opening brackets and closing brackets are not equal" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement