Help

Revision ru1, by Recos, 2015-11-01 17:45:10

HI!

I cant display russian string in c++

I have WA1 in this task

Who knows how to fix this problem

I tried many times

#include<iostream>
#include<windows.h>
#include<locale.h>
#include<cstdio>
#include<string.h>
#define name ""
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define sz(s) ((int) s.size ())
#define all(s) s.begin (), s.end ()

using namespace std;
int a,b,c;
int main () {
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  string s;
  getline(cin,s);

setlocale(LC_ALL ,"Russian");
  for(int i=0;i<s.size();i++)
  {
    if(s[i]=='(')
        a++;
    else if(s[i]==')')
      a--;
    if(s[i]=='[')
      b++;
    else if(s[i]==']')
      b--;
    if(s[i]=='{')
      c++;
    else if(s[i]=='}')
      c--;

  }
  if(a==0&&b==0&&c==0)
    cout<<"Да";
  else cout<<"Нет";
  return 0;
}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru1 Russian Recos 2015-11-01 17:45:10 1033 Первая редакция (опубликовано)