searching through a array of string

ساخت وبلاگ

Vote count: 0

so i have this set of strings which are stored in an array i want to search the array so when the string is found it should say found and when its not found it should say invalid this is what i have so far

cout << "Enter a Name to Search" <<endl;
cin >>userInput;
for (int i=0; i<size; i++)
{ if (first_name[i]==userInput) { cout <<"Found"<<endl; }else{ cout << "InValid"<<endl; break; }
}

so every time i run this i am always redirected to The else Statement is there anyway for me to fix this

asked 30 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : javascript search through array of strings,objective c search through array of strings, نویسنده : استخدام کار backsoft بازدید : 241 تاريخ : سه شنبه 19 مرداد 1395 ساعت: 11:25