Alright, so I've worked out how to write my program to create "beautiful" rectangles of various colors with a user specified character. The problem I'm having is with this little bit of code.
cout << "Enter drawing chracter: ";
cin >> drawChar;
cout << "Background color is black\n";
cout << "Would you like to change it? [y/n] ";
cin >> background;
background = tolower(background);
Console::SetWindowSize(width < 35 ? 35: width + 6, height + 6);
Console::Clear();
if( background = 'n')
{
Console::BackgroundColor = ConsoleColor::Black;
}
elseif (background = 'y')
{
Console::BackgroundColor = ConsoleColor::White;
}// end if
Even if I enter y when asked if I would like to change background color it does not change to white. The code to change the background color works fine without the if statement. I looked through it quite a long time and I have no idea why it won't work. A thought I had was that there was stuff lying around in the buffer from previous user input. I don't know if that is possible or where it would some from though. Any help appreciated. More code available upon request. Thank you!
I don't really see what you are trying to get at. It appears to me as if you copy pasted my code. I believe they are the correct way. If not I tested it both ways so it's not the problem of a swapped y and n. Thank you though.