Solved .exe has stop working.

November 20, 2014 at 06:44:37
Specs: Windows 7
I'm getting a popup saying that the program.exe which i'm running after compile has stop working.
i'm not sure what to do.

#include <stdio.h>
#include <string.h>

int main()
{
char password[14] = "student14";
char r_password[20];
char input_user[14];
char name[20];
char security_code[20] = "532353132995035";
char input_security[20];
int decision;
int x;
int y;

printf("If you already have an account please enter '1', \nwhile for does who doest'n have an account and \nwant to registered please enter '2' \n");
scanf("%d", decision);

switch (decision)
{
case 1:
printf("Please input your name and password. \n");
printf("Name:");scanf("%[^\n]", name);
fflush(stdin);

for (x = 0; x < 3; x++)
{
printf("Password:");scanf("%[^\n]", input_user);
fflush(stdin);

if (strcmp (input_user, password) == 0)
break;
else
printf("\nAccess Denied\n\a");

}

if (strcmp (input_user, password) == 0)
{
printf("\nAccess Granted\n\nWelcome back %s", name);

}

else
{
printf("\n\nYou have entered wrong password 3 times.\nYou have 10 chance before system lockdown initiated");
for (y = 0; y < 10; y++)
{
printf("\n\nPlease input your 15 digit security code\n");
printf("Security Code: ");scanf("%[^\n]", input_security);
fflush(stdin);

if (strcmp (input_security, security_code) == 0)
break;
else
printf("\nAccess Denied\n\a");


}
if (strcmp (input_security, security_code) == 0)
{
printf("\nAccess Granted.\nCongratulation %s,you finaly able to enter you program.", name);
}
else
{
printf("Your system is currently under lockdown sequence.\n\nPlease try again after 10 minutes");
}

}

break;

case 2:
printf("Please input your password(password my be below 20 char or digit)\n");
scanf("[^\n]", r_password);
printf("\nYour password has been saved, you will be directed to login sequence");
break;

default:
printf("Your answer is not recognised");
}


getchar();
fflush(stdin);
return 0;
}


See More: .exe has stop working.

Report •


#1
November 21, 2014 at 06:36:43
✔ Best Answer
Your first syntax problem is this:

scanf("%d", decision);

scanf requires using the address of a variable:

scanf("%d", &decision);


Report •
Related Solutions


Ask Question