QUOTE(William_Wilson @ 26 Sep, 2008 - 04:44 PM)

the \ symbol is an escape character, you need to escape IT to use it: "\" is incorrect, "\\" is correct.
Can you expand a little more? I kind of don't understand. I'm a newbie to C++. Thank You!
QUOTE(villalandron @ 27 Sep, 2008 - 09:40 AM)

QUOTE(William_Wilson @ 26 Sep, 2008 - 04:44 PM)

the \ symbol is an escape character, you need to escape IT to use it: "\" is incorrect, "\\" is correct.
Can you expand a little more? I kind of don't understand. I'm a newbie to C++. Thank You!
This is how my code looks like:
cpp
#include <iostream>
#include <fstream>
using namespace std;
#define MAX_WORD_SIZE 6
#define MAX_WORDS 255
void RunGame();
void DrawGallows(int State);
typedef char String[MAX_WORD_SIZE];
String Words[MAX_WORDS -1];
char choice, Yes;
char Continue = Yes;
int State;
int count;
int main()
{
cout << "Welcome to Hangman" << endl;
{
void RunGame();
cout << "Do you want to play again (Yes or No)?" << endl;
cin >> Continue;
Continue = toupper(Continue);
}
cout << "Thanks for Playing." << endl;
char C;
ifstream Datfile;
count=0;
while((C=Datfile.peek()) != EOF)
Datfile >> Words [count++];
if (count > MAX_WORDS - 1)
count--;
Datfile.close();
void Rungame();
{
int Word;
int Size;
int State = 1;
int Subscript=0;
char guess[MAX_WORD_SIZE];
char copy[MAX_WORD_SIZE];
char letter;
int Correct = 0;
strcpy_s(copy,Words[Word]);
Size = strlen(Words[Word]);
for(; Subscript < Size; Subscript++);
{
guess[Subscript] = '-';
}
guess[Subscript] = '\0';
while(State != 6)
{
DrawGallows(State);
cout << "Guess the word: XXXXXX" << endl;
cout << "Guess a letter: " << endl;
cin >> letter;
letter = tolower(letter);
for(Subscript =0; Subscript < Size; Subscript++)
{
if(copy[Subscript] == letter)
{
guess[Subscript] = letter;
Correct = 1;
cout << "Good Guess." << endl;
if(strcmp(Words[Word], guess) == 0)
{
cout << "Congratulations! You guessed the word...play again? Yes/No" << endl;
cin >> choice;
while(Continue == 'Yes');
}
}
}
if(Correct = 0)
{
cout << "Sorry, Bad Guess!" << endl;
State++;
}
Correct = 0;
}
DrawGallows(State);
}
void DrawGallows(int State);
{
if(State==6)
{
cout << endl << endl
<<" +----+ "<< endl
<<" | | "<< endl
<<" | O "<< endl
<<" | /|\ "<< endl
<<" | / \ "<< endl
<<" |Your Dead "<< endl
<<" ============"<< endl << endl;
}
else if(State==5)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /|\ "<<endl
<<" | \ "<<endl
<<" | "<<endl
<<" ============"<<endl<<endl;
}
else if(State==4)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /|\ "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
else if(State==3)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | /| "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
else if(State==2)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | O "<<endl
<<" | | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
else if(State==1)
{
cout<<endl<<endl
<<" +----+ "<<endl
<<" | | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" | "<<endl
<<" ============="<<endl<<endl;
}
}
system ("pause");
return 0;
}
and these are the error messages:
1>.\hangman.cpp(128) : warning C4129: ' ' : unrecognized character escape sequence
1>.\hangman.cpp(129) : warning C4129: ' ' : unrecognized character escape sequence
1>.\hangman.cpp(140) : warning C4129: ' ' : unrecognized character escape sequence
1>.\hangman.cpp(141) : warning C4129: ' ' : unrecognized character escape sequence
1>.\hangman.cpp(151) : warning C4129: ' ' : unrecognized character escape sequence
1>c:\users\julio\documents\visual studio 2008\projects\hangman\hangman\hangman.cpp(64) : warning C4700: uninitialized local variable 'Word' used
1>Linking...
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>hangman.obj : error LNK2028: unresolved token (0A000315) "void __cdecl DrawGallows(int)" (?DrawGallows@@$$FYAXH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>hangman.obj : error LNK2019: unresolved external symbol "void __cdecl DrawGallows(int)" (?DrawGallows@@$$FYAXH@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>C:\Users\Julio\Documents\Visual Studio 2008\Projects\hangman\Debug\hangman.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Users\Julio\Documents\Visual Studio 2008\Projects\hangman\hangman\Debug\BuildLog.htm"
1>hangman - 3 error(s), 7 warning(s)
Thank You!
MOD EDIT: Please