Kod:
#include <iostream>
#include <ostream>
#include "stdafx.h"
#include <string>
#include <stack>
using namespace std;
int hata_kontrol(string ifade) {
int sayi;
stack<char> S;
for (int i = 0; i < ifade.length(); i++)
{
if (ifade[i] == '(' || ifade[i] == '{' || ifade[i] == '[')
{
sayi++;
S.top();
S.push(ifade[i]);
}
else if (ifade[i] == ')' || ifade[i] == '}' || ifade[i] == ']') {
sayi--;
S.pop();
if (sayi < 0)
return sayi + 2;
}
}
return sayi;
}
int main()
{
string ifade = "";
cout << " ifadenizi girin : ";
cin >> ifade;
if (hata_kontrol(ifade) == 0) {
cout << "ifadede parantez hatasi yok";
}
else if (hata_kontrol(ifade) > 0) {
cout << "ifadede parantez kapatilmamis";
}
else {
cout << "ifade de parantez acmamissin";
}
}
kod'um bu şekilde ama derlerken şöyle hatalar alıyorum ;

