Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct phoneBook
- {
- char name[100];
- char name2[100];
- int number;
- };
- int main ()
- {
- int i,j,x=0,n;
- cin >> n;
- struct phoneBook friends[n];
- for(i=0; i<n; i++)
- {
- cin >> friends[i].name >> friends[i].number;
- }
- for(i=0; i<n; i++)
- {
- cin >> friends[i].name2;
- }
- for(i=0; i<n; i++)
- {
- for(j=0; friends[i].name[j] != '\0'; j++)
- {
- if(friends[i].name[j] != friends[i].name2[j])
- {
- x++;
- }
- }
- if (x==0)
- {
- cout << friends[i].name << "=" << friends[i].number << "\n";
- }
- else
- {
- cout << "Not found" << "\n";
- }
- x = 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment