Hello everybody,
I was trying to make a telephone directory, when I ran in to several problems with the compiling. When I fixed these, I saw that the programm wasn't working as I want it to work :)
Can anyone tell me what I did wrong, and try to help me out of this?
#include <cstdio>
#include <cstring>
int main ()
{
char name[10][10], temporary_name[10];
char option[6];
__int64 number[10];
int i,j,k;
char quit[10];
do {
printf ("This is a telephone directory.\n");
printf ("What do you want to do?\n");
printf ("Typ 'enter' to enter a number, typ 'view' to view a number.\n");
scanf ("%s\n", &option);
if (option == "enter") {
printf ("What is the name of the person?\n");
for (j = 0; j < 10; j++) {
gets (name[j]);
}
printf ("What is the number of the person?\n");
for (k = 0; k <10; k++) {
scanf ("%I64d", &number[k]);
}
printf ("Person stored in memory.\n");
}
else {
printf ("Enter the name of the person.\n");
gets (temporary_name);
for (i = 0; i < 10; i++) {
if (strcmp (name[i],temporary_name) != 0) {
printf ("%I64d\n", number[i]);
}
}
}
printf ("What do you want to do now?\n");
printf ("Typ continue if you want to go to the menu, typ exit to exit.\n");
scanf ("%s", &quit);
} while (quit != "exit");
return 0;
}