I cant find the error in this piece of code could anyone please insight me? I ran the debugging but the errors are un-understandable..
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
string name;
cout << "Input your name please?" << endl;
cin >> name;
if
{
(name == "Bart Simpson")
cout << "You have been very naughty" << endl;
}
return 0;
}
Problems:
#includes, which probably caused your initial compiler errors.ifstatement.The following should work as you expect:
(You need to include
stringforstd::stringandstd::getline, andostreamforstd::endl.)