Hello again!
I asked for help before for opening a web page. I got around that and added things to it.
A way to choose your activity, and a way to exit the program.
Well i want feedback on what you think about it. I have an error that happens at the end (when i get the correct password, get the web page opened, and enter "4" to exit the program) that i don't know how to fix. But i also want feedback overall, so go ahead!
here's the code:
Code:#include <stdio.h> #include <stdlib.h> #include <windows.h> int main() { char* pass="hello"; char* hint="Form of salutation"; char* search="http://www.goolge.com"; char* news="http://www.cnn.com"; char* email="http://www.hotmail.com"; int* activity; char* p; int i=0; int a=0; printf("Enter password and press ENTER.\n \n"); do { printf("Password: "); scanf( "%s", p); if(strcmp ( p, pass ) == 0) { printf("Correct Password. \n \n"); i=10; } else { if(strcmp ( p, "hint" ) == 0) { printf("Password Hint: %s. \n \n", hint); } else { printf("Incorrect Password. \nType 'hint' for help. \n \n"); i++; } } } while (i<3); do { printf("Choose your activity:\n1. Search\n2. News\n3. eMail\n4. Exit\n\n"); printf("Enter a number: "); scanf( "%s", activity); if (strcmp ( activity, "1" ) == 0) { ShellExecute(NULL, "open", search, NULL, NULL, SW_SHOWNORMAL); } if (strcmp ( activity, "2" ) == 0) { ShellExecute(NULL, "open", news, NULL, NULL, SW_SHOWNORMAL); } if (strcmp ( activity, "3" ) == 0) { ShellExecute(NULL, "open", email, NULL, NULL, SW_SHOWNORMAL); } if (strcmp ( activity, "4" ) == 0) { i=20; } if (i==10) { printf("\nOpening application...\n"); printf("Press any key to continue.\n"); printf("\n--------------------------------\n\n"); getch(); } } while (i == 10); printf("\n---- PROGRAM TERMINATED ----\n--- PRESS ANY KEY TO END ---\n"); getch(); return 0; }



LinkBack URL
About LinkBacks



