Hello, back again from a while of non-programming... And having problems with the following project.
I'm writing a program that aims to take in characters, any number, hit by the user, and run programs according to what was entered. I want to be able to run this program, hit "m", and get my WinAmp run, or hit "mo" and get my Winamp and Opera run. However, I'm having a lot of problems, and I'll probably kick myself when I'm told what I'm doing wrong. I'd be grateful if people could take a look. Thanks.
Code:
#include <iostream.h>
#include <windows.h>
#include <conio.c>
int main()
{
MessageBox(NULL, "Hit OK, type the passkeys\nand hit ENTER.", "Run", MB_OK);
char a[7];
char* pA = a;
cin >> a;
char* b = "m";
char* c = "o";
char* d = "t";
char* e = "i";
char* f = "k";
char* g = "w";
bool music = FALSE;
bool opera = FALSE;
bool trillian = FALSE;
bool imesh = FALSE;
bool kazaa = FALSE;
bool winmx = FALSE;
for(int i = 0; i < 8; i++)
{
if(strcmp(b, &pA[i]) == 1)
{
music = TRUE;
}
if(strcmp(c, &pA[i]) == 1)
{
opera = TRUE;
}
if(strcmp(d, &pA[i]) == 1)
{
trillian = TRUE;
}
if(strcmp(e, &pA[i]) == 1)
{
imesh = TRUE;
}
if(strcmp(f, &pA[i]) == 1)
{
kazaa = TRUE;
}
if(strcmp(g, &pA[i]) == 1)
{
winmx = TRUE;
}
}
if(music == 1) system("C:\\Documents and Settings\\All Users.WINDOWS\\Documents\\Quent\\Music.m3u");
if(opera == 1) system("C:\\Program Files\\Opera7\\Opera.exe");
if(trillian == 1) system("C:\\Program Files\\Trillian\\trillian.exe");
if(imesh == 1) system("C:\\Program Files\\iMesh\\Client\\iMeshClient.exe");
// if(kazaa == 1)
if(winmx == 1) system("C:\\Program Files\\WinMX\\WinMX.exe");
MessageBox(NULL, "End of Program.", "Run", MB_OK);
return 0;
}
Don't mind the bad presentation, I had to declare variables when the original way I coded it didn't work, now it compiles but doesn't run properly. Thanks for any help.