Answer the question
In order to leave comments, you need to log in
What is the error, Visual Studio 2017?
I just installed Microsoft Visual Studio 2017. At first there was a problem - I couldn't find the project.exe file. It turned out that the problem is with the SDK. Installed a new one, everything seems to be fine. Program:
#include <iostream>
using namespace std;
int main() {
cout << "Why don't you work?!!";
return 0;
/* Program 03.12.2018 */
#include <iostream>
#include <string>
#include <stack>
using namespace std;
bool IsCorrectSequence (const string& sq) {
stack <char> seq;
char v;
for (const char& c: sq) {
v = seq.top();
if ((c == ')' && v == '(') ||
(c == ']' && v == '[') ||
(c == '}' && v == '{')) {seq.pop();}
else if (c == ')' || c == ']' || c == '}') {return false;}
else {seq.push(c);}
}
return true;
}
int main() {
string s;
cin >> s;
cout << "S is " << (IsCorrectSequence(s) ? "correct sequence" : "not correct sequence") << endl;
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question