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 61 62 63 64 65 66 67 68 69 70 71
|
#include "StdAfx.h"
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string input;
cout << "Please type the name of the game you would like to play below(Gmod, EP1, EP2, TF2, HL2:DM, HL2, HL1, Portal, or CS:S:\n";
cin >> input;
do
{
if (input == "Gmod" || input == "gmod")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\garrysmod\\hl2.exe\"");
cout << "Garry's Mod is now running!";
}
else if (input == "EP1" || input == "Ep1")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\half-life 2 episode one\\hl2.exe\"");
cout << "Half-Life 2:Episode 1 is now running!";
}
else if (input == "EP2" || input == "Ep2")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\half-life 2 episode two\\hl2.exe\"");
cout << "Half-Life 2:Episode 2 is now running!";
}
else if (input == "TF2" || input == "Tf2")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\team fortress 2\\hl2.exe\"");
cout << "Team Fortress 2 is now running!";
}
else if (input == "HL2:DM" || input == "Hl2:dm")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\half-life 2 deathmatch\\hl2.exe\"");
cout << "Half-Life 2:Death Match is now running!";
}
else if (input == "HL2" || input == "Hl2")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\half-life 2\\hl2.exe\"");
cout << "Half-Life 2 is now running!";
}
else if (input == "HL1" || input == "Hl1")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\half-life 1\\hl.exe\"");
cout << "Half-Life 1 is now running!";
}
else if (input == "Portal" || input == "portal")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\portal\\hl2.exe\"");
cout << "Portal is now running!";
}
else if (input == "CS:S" || input == "Cs:s")
{
system("\"C:\\Program Files\\Steam\\steamapps\\vypr11\\counter-strike source\\hl2.exe\"");
cout << "Counter-Strike:Source is now running!";
}
else
{
cout << "That is not a valid answer, please input a correct answer:\n";
cin >> input;
continue; //Check again
}
while (false);
cin.get();
cin.get();
return 0;
|
build error:
(75): fatal error C1075: end of file found before the left brace '{
Where am I missing a bracket at?
Last edited on
Before the while(false); I think. Assuming you end main() properly (it's not on the code you've posted).
Igot it working, but can you explain and provide an example of how to navigate to a directory using shellexecute?
shellexecute("path here")?