Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. int main(){
  5. char str[100];
  6. int i,o_b,c_b;// o_b - opening bracket; c_b - closing bracket.
  7. cout << "Input string, please:" << endl;
  8. cin >> str[100];
  9. o_b=c_b=0;
  10. for (i = 0; i <= strlen(str); i++) {
  11. str[i] == ')' && c_b++;
  12. str[i] == '(' && o_b++;
  13. }
  14. if (o_b == c_b)
  15. cout << "the number of opening brackets and closing brackets are equal" << endl;
  16. else
  17. cout << "the number of opening brackets and closing brackets are not equal" << endl;
  18. system("pause");
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement