Dec 21, 2013 at 5:06pm UTC
I'm using windows 8 and my taskbar keeps filling up with games, so i decided to write a program from where i can open all of the games. I'm just wondering if there's a faster or more compact way of doing that?
Code so far:
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85
#include <conio.h>
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
int game;
cout << "Choose a game\n" ;
cout << "1. Toribash\n2. FarCry 3\n3. Terraria\n4. Assassin's Creed III\n5. Need For Speed: THE RUN\n6. Assassin's Creed IV\n7. Saints Row IV\n8. The Sims 3\n9. Torchlight 2\n10. Dragons Prophet\n11. The Movies\n" ;
cin >> game;
if (game == 1)
{
cout << "Opening Toribash" << endl;
system("\"D:\\Games\\Toribash-4.5\\toribash.exe\"" );
return 0;
}
if (game == 2)
{
cout << "Opening FarCry 3" << endl;
system("\"D:\\Games\\FarCry 3\\bin\\farcry3.exe\"" );
return 0;
}
if (game == 3)
{
cout << "Opening Terraria" << endl;
system("\"D:\\Games\\Terraria\\Terraria\\Terraria.exe\"" );
return 0;
}
if (game == 4)
{
cout << "Opening Assassin's Creed III" << endl;
system("\"D:\\Games\\Assassin's Creed III\\AC3SP\"" );
return 0;
}
if (game == 5)
{
cout << "Opening Need For Speed: THE RUN" << endl;
system("\"D:\\Games\\Need for Speed The Run\\Need For Speed The Run\"" );
return 0;
}
if (game == 6)
{
cout << "Opening Assassin's Creed IV" << endl;
system("\"D:\\Games\\Assassins Creed IV Black Flag\\AS4BFSP\"" );
return 0;
}
if (game == 7)
{
cout << "Opening Saints Row IV" << endl;
system("\"D:\\Games\\Saints Row IV\\SaintsRowIV\"" );
return 0;
}
if (game == 8)
{
cout << "Opening The Sims 3" << endl;
system("\"D:\\Games\\The Sims 3\\Game\\Bin\\TS3\"" );
return 0;
}
if (game == 9)
{
cout << "Opening Torchlight 2" << endl;
system("\"D:\\Games\\Torchlight 2\\Torchlight2\"" );
return 0;
}
if (game == 10)
{
cout << "Opening Dragons Prophet" << endl;
system("\"D:\\Games\\Dragons Prophet\\launchPad.exe\"" );
return 0;
}
if (game == 11)
{
cout << "Opening Dragons Prophet" << endl;
system("\"D:\\Games\\The Movies\\MoviesSE\"" );
return 0;
}
system("pause" );
return 0;
}
Last edited on Dec 21, 2013 at 5:20pm UTC
Dec 21, 2013 at 5:21pm UTC
use a switch statement, or at the very least if..else statements, rather than just if statements.
Dec 21, 2013 at 5:39pm UTC
yep :)
You can then use the default case to handle if the user enters 27 or something. ('Game does not exist' etc etc).
Last edited on Dec 21, 2013 at 5:41pm UTC
Dec 21, 2013 at 6:26pm UTC
i don't understand anything IceThatJaw :D (WriteLine thing)
Last edited on Dec 21, 2013 at 6:53pm UTC