Stumped

#include <iostream>
using namespace std;

#include <cwchar>
using namespace std;

#include <windows.h>;

char response;
FILE a;

int main()
{
cout << "Would you like to play a game? Y/N?";

cin >> response;
{
if (response == "y") //It says that operands are incompatible
cout << "What game would you like to play? Please type in exactly what the game is called including spaces, dashes, or capitalization.";
cin >> a; //For some reason it says that no operator matches the operands

WIN32_FIND_DATA file;
HANDLE search_handle=FindFirstFile("C:\\*",&file);
if (search_handle)
{
do
{
std::wcout << file.cFileName << std::endl;
}while(FindNextFile(search_handle,&file));
CloseHandle(search_handle);

}

}

else if (response == "n") // I know I did something wrong here. I just don't know how to fix it.
cout << "Goodbye!";

//countdown loop
for (int n=3; n>0; n--) {
cout << n << ", ";
}
cout << "CIAO!\n";
return 0;
}
You're trying to compare a char with a char array.
Try using a character literal.
 
if (response == 'y') // Note the single quotes, not double quotes 


PLEASE USE CODE TAGS (the <> formatting button) when posting code.



Thanks! That solved one problem. But I still don't know what's wrong with the cin >> a;
Also, if someone could help me solve the else if (response == "n") that would be very helpful.
 
if (response == 'n')  // exactly the same problem as before.  Use single quotes 


 
cin >> a; //For some reason it says that no operator matches the operands 

a is type FILE. You can't do a cin to a FILE object.
Topic archived. No new replies allowed.