Alright now my objective is a little corny, but im trying to make a program to identify a person by age or name. (also it was to get me to start coding, I'm making to put in it as I go.) I already can get it by inputting a number, but when i try to get it to replie to names it doesn't work. i think the problem is with the scanf but i honestly don't know. please help
Code:
#include <stdio.h>
int main(void)
{
int x;
x = 1;
{
int age;
char name;
do{
printf("Hello, I am the Smart computer.\nTell me your name or age, and I will Identify:");
scanf("%d", &age);
scanf("%d", &name);
if(age == 14) {
system("cls");
printf("How's it hangin Ben\n", x);
system("pause");
system ("cls");
}
else if ( age == 42) {
system("cls");
printf("Hey pops\n", x);
system("pause");
system ("cls");
}
else if ( age == 17) {
system("cls");
printf("hey good lookin\n", x);
system("pause");
system ("cls");
}
else if ( age == 9) {
system("cls");
printf("Nick, two for flinching!!!!\n", x);
system("pause");
system ("cls");
}
else if (age == 6) {
system("cls");
printf("Hey, Mikal! :P\n", x);
system("pause");
system ("cls");
}
else if (age == 4) {
system("cls");
printf("Chewy, I'm ganna eat'ya!!\n", x);
system("pause");
system ("cls");
}
else if (age == 2) {
system("cls");
printf("Hey roo, wannta play some hockey aye?\n", x);
system("pause");
system ("cls");
}
else if (age == 21) {
system("cls");
printf("Kansas won.. it seems the student has become the master.\n", x);
system("pause");
system ("cls");
}
else if (age == 23) {
system("cls");
printf("Ryan Andrew... bluesclues, bluesclues.\n", x);
system("pause");
system ("cls");
}
else if (age == 43){
system("cls");
printf("Congragulations on the new baby, God Bless.\n", x);
system("pause");
system ("cls");
}
else if (name == 'cameron'){
system ("cls");
printf ("Oh! How's it goin boss?\n");
system ("pause");
system ("cls");
}
else if (name == 'exit'){
system("cls");
printf("Sysetm failer, thanks alot.\n", x);
system("pause");
getchar();
return 0;
}
else {
system("cls");
printf("I don't know you, therefore you don't exsist. Good day.\n", x);
}
}while (x != 0);
}
system("pause");
}