String Error

Well, in my code, a jumble of letters will appear and if the user doesn't type them in correctly, they lose. However whenever I try to check if the user inputed the correct jumble of letters, it says that jumble is an undeclared identifier. Here is my code:

[code=cpp]
#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

int main()

{
//variables
string answer = dsahfkjd;
string guess;
//code
cout << "Say " << answer << endl;
cin >> guess;
if(guess == answer)
{
cout << "Good Job!" << endl;
system("PAUSE");
}
else
{
cout << "You lose and you suck. Haha." << endl;
system("PAUSE");
return (0);
}
}
[/code]

Here is the error I am receiving.

 
error C2065: 'dsahfkjd' : undeclared identifier


Please tell me what I am doing wrong!
closed account (z05DSL3A)
string answer = "dsahfkjd";
Ahh, thanks. :)

Also, how would I add a timer, such as, if they don't answer within a certain amount of time they will lose?
Last edited on
Topic archived. No new replies allowed.