我又努力了一下,把zeng9999jian的百家姓从一百多行给压缩到二十几行,我真棒!
#include<bits/stdc++.h>
using namespace std;
string a[100]={
"zeng","jiang","zhou","yan","yao",
"xu","huang","meng","pan","fang",
"zhao","qian","li","wu","zheng",
"wang","feng","chen","chu","wei",
"su","shen","han","yang","zhu","qin",
"you","he","lu","shi","zhang","kong",
"cao","hua","jin","tao","xie","zou",
"yu","bai","shui","dou","yun"
};
int main(){
string b;
cout<<"请输入姓氏的拼音,如zhou(周),如果有这个姓氏,则输出true,反之则输出false\n";
cout<<"因为这个只有46个姓氏,所以可能不准\n退出请输入“退出”\n";
while(cin>>b){
if(b=="退出")return 0;
for(int i=0;i<43;i++){
if(a[i]==b)
cout<<"true"<<endl;
if(i==43)
cout<<"false"<<endl;
}
}
}
大聪明+马牛逼(666,你很牛逼呀) 百家姓的姓氏再多一点,我的姓氏找不到
大 聪 明
谢谢夸奖
嘿嘿,不用谢