1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include <iostream>
#include <cwchar>
#include <string>
#include <Windows.h>
using namespace std;
#include <stdlib.h>;
char response;
string fname;
int main()
{
cout << "Would you like to play a game? Y/N?";
cin >> response;
if (response == 'n')
{
cout << "Goodbye!";
//countdown
Sleep (1 * 1000);
cout << "5"<<endl;
Sleep (1 * 1000);
cout << "4"<<endl;
Sleep (1 * 1000);
cout << "3"<<endl;
Sleep (1 * 1000);
cout << "2"<<endl;
Sleep (1 * 1000);
cout << "1"<<endl;
Sleep (1 * 1000);
cout << "CIAO!\n"<<endl;
Sleep (1 * 1000);
return 0;
}
if (response == 'y' || response == 'Y');
{
cout << "What game would you like to play? Please type in exactly what the game is called including spaces, dashes, or capitalization.";
cin >> fname;
WIN32_FIND_DATA file;
HANDLE search_handle=FindFirstFile("C:\\*",&file); //Not sure if I should change the file part, but it's undefined.
if (search_handle)
{
do
{
if(0 == strcmp(fname, "a")) //No suitable conversion function from string to char exists
{CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) ||
ShellExecute(handle, "find", <fully_qualified_path_to_folder>, NULL, NULL, 0)|| //handle is undefined
//and the <fully.... expected an expression
ShellExecute(handle, NULL, <fully_qualified_path_to_folder>, NULL, NULL, SW_SHOWNORMAL);
std::cout << "Found the game you wanted to play!" << std::endl;
while(FindNextFile(search_handle,&file))
FindClose(search_handle);
system("pause");
}
return 0;
}
|