I want to search for a name from a list of names and if its found I should return the whole info of that person else not found. I dont know why my code is not working. I can print the info of the person, eg:
Input:
3 Steve 9812761810 017 Wayne 8299915781 102 Ronnie 9161462903 120 Wayne
Output:
Wayne 8299915781 102
#include <iostream>
#include <string.h>
using namespace std;
int main() {
string name[100];
long long number[100];
int year[100], i, n, check = 0;
string inp;
cin >> n;
for (i = 0; i < n; i++) {
cin >> name[i] >> number[i] >> year[i];
}
cin >> inp;
for (i = 0; i < n; i++) {
if (inp == name[i]) {
check = 1;
}
}
if (check == 0)
cout << "Info Not found";
else
cout << "The Entered Name is found";
for (i = 0; i < n; i++)
cout << name[i] << number[i] << year[i];
return 0;
}