I merely want a discussion rather than you giving me code.
This is what I have so far. The main code has the function name with the 2 variables it is passing over to it.
void wordGuess::checkLetter(std::string&input,char &guess)
{
int w=0;
if(crs)
crs->setPosition(xcd,ycd);
if(cl);
switch(clr)
{
case 1: cl->setForeground(Black); break;
default: case 2: cl->setForeground(White); break;
case 3: cl->setForeground(Blue); break;
case 4: cl->setForeground(Green); break;
case 5: cl->setForeground(Aqua); break;
case 6: cl->setForeground(Red); break;
case 7: cl->setForeground(Purple); break;
case 8: cl->setForeground(Yellow); break;
}
while(w<input.size())
{
cout << "Enter your guess: ";
cin >> guess;
for(int i=0;i<=10;i++)
{
if(guess==input[i])
{
cout<<"You got one";
qin.get();
w++;
if(crs)
crs->setPosition(xcd,ycd);
cin>>guess;
}
else;
cout << "no";
}
}
}
This code is looking at an inputted char in a string and hopes to find it. It is the game of hangman so eventually I hope this function can print out the correct letter and the wrong letters into various positions on screen.
However this function seems to return a horrible "Debug Assertion Failed" I have never seen before.
Any ideas of what to try with this function?

New Topic/Question
Reply


MultiQuote




|