C Programming Beginner in need of assistance!
Essentially, i am trying to create a program that when i type certain applications to open, the program will open that program.
Please see the below code. (Apologies if its messy its literally my first one).
Code:
#include <stdio.h>
#include <windows.h>
int main() {
char input[100];
char name[20];
{
printf("Hello User, please enter your name:\n", name);
scanf("%s", name);
printf("Thank you, %s\n", name);
}
{
printf("What program would you like to open, %s?\n", name);
scanf("%s", input);
}
if (strcmp(input,"Open Google Chrome") == 0);
{
printf("Opening Google Chrome for you!\n");
ShellExecute(NULL, "open","chrome.exe",NULL,NULL,SW_SHOWNORMAL);
}
//system("Start "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"); This doesnt seem to work? Use shell Execute instead.
{
printf("done");
}
return 0;
}
The issue is, if i type literally anything, it will still open Google Chrome. I want to have to type "Google Chrome" in order for it to open.
Does that make sense?
If so any help would be greatly appreciated, thanks!