Question: In a room , there are three students Yuki, Shiro and Kaname. You have to display that their name exists on giving the input. Also ,please give me the corrected program.Example:INPUT:Enter no of students: 3 (no of students)Enter name:YukiShiro KanameEnter name to be searched: ShiroOUTPUT:Shiro exists!!What I have tried:#include <iostream>#include <string.h>using namespace std;int main(){ string s[10], y; int i; for (i=0; i< 3; i++) cin>>s[i]; cin>>y; if (y == s[i]) cout<< y << " exists"; else cout<< y <<"Does not exist"; return 0;} 解决方案 这篇关于如何创建C或C ++程序来搜索名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-18 17:38