Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main (void)
- {
- int antalKonton;
- int i;
- int amount = 0;
- int namecheck = 0;
- char personFinder[30];
- printf ("How many useraccounts do you want to enter? \n");
- scanf ("%d", &antalKonton);
- struct account* arr= (struct account*) malloc (sizeof (struct account)*antalKonton);
- if (arr == NULL)
- printf ("Could not allocate %d elements", antalKonton);
- else
- {
- for (i=0; i< antalKonton; i++)
- {
- arr[i] = konto();
- }
- printf ("Username: \t \t password: \n");
- for (i=0; i<antalKonton; i++)
- {
- printf ("%s \t \t %s \n", arr[i].username, arr[i].password);
- }
- do
- {
- printf("enter the username of the person ur looking for:");
- scanf("%s", personFinder);
- for (i = 0; i < amount; i++)
- {
- namecheck = (strcmp(arr[i].username, personFinder));
- if (namecheck == 0)
- {
- printf("the password associated with %s is: %s\n", personFinder, arr[i].password);
- i = amount + i;
- }
- }
- if(namecheck >0||namecheck !=0)
- printf("no account with that name here\n");
- } while ((namecheck = (strcmp(personFinder, "none") != 0)));
- }
- free(arr);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement