40 lines
563 B
C
40 lines
563 B
C
#include <cs50.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
typedef struct
|
|
|
|
{
|
|
string name;
|
|
string number;
|
|
|
|
} person;
|
|
|
|
int main(void)
|
|
|
|
{
|
|
person people[3];
|
|
|
|
people[0].name = ""Kelly";
|
|
people[0].number = "+091398023890123";
|
|
|
|
people[1].name = "Hayet";
|
|
people[1].number = "77666327";
|
|
|
|
people [2].name ="Munna";
|
|
people[2].number ="59950786";
|
|
|
|
string name = get_string("Name: ");
|
|
for (int i = 0 ; i < 3; i++)
|
|
|
|
{
|
|
if (strcmp(people[i].name, name) == 0)
|
|
{
|
|
printf("Found %s\n", people[i].number);
|
|
return 0;
|
|
}
|
|
}
|
|
printf("Not fouind \n");
|
|
return 1;
|
|
}
|