visual c++ - Reguarding Syntax of VS C++ 2010 and the reason I cannot build it -
would mind pointing out me, has been quite while since have compiled c++ code, reason following code generating error on attempt build it. attempt build basic, entry level, win32 console application , ide has been configured expect much. thank, in advance, whoever might take time point out oversite. code follows:
#include "stdafx.h" #include <iostream> using namespace std; bool accept() { int tries = 1; while (tries < 4) { cout << "do want proceed (y or n)?\n"; char answer = 0; cin >> answer; switch (answer) { case 'y': return true; case 'n': return false; default: cout << "sorry, don't understand that.\n"; tries = tries ++; } cout << "i'll take no.\n"; return false; system("pause"); }
the error message is:
1>c:\users\court\documents\visual studio 2010\projects\cpp1\cpp1\cpp1.cpp(37): fatal error c1075: end of file found before left brace '{' @ 'c:\users\court\documents\visual studio 2010\projects\cpp1\cpp1\cpp1.cpp(10)' matched error follows:
again, thank you, in advance assistance might afforded.
looks you're missing closing brace after switch statement. it's isn't obvious due missing indent after 'while'.
Comments
Post a Comment