先声明一下,这是一篇水帖。
百家姓(3)
今天自己开始有些想不出来了,搜了搜百度。。。。嘿嘿~
上代码:
#include<bits/stdc++.h>
using namespace std;
string a;
int main() {
cin >> a;
string b = "zeng";
string c = "jiang";
string d = "zhou";
string e = "yan";
string f = "yao";
string g = "xu";
string h = "zhu";
string i = "huang";
string j = "meng";
string k = "pan";
string l = "fang";
string m = "zhao";
string n = "qian";
string o = "li";
string p = "wu";
string q = "zheng";
string r = "wang";
string::size_type idx;
idx = a.find(b);
if (idx == string::npos )
cout << "";
string::size_type idx_b;
idx = a.find(c);
if (idx_b == string::npos )
cout << "";
string::size_type idx_c;
idx = a.find(d);
if (idx_c == string::npos )
cout << "";
string::size_type idx_d;
idx = a.find(e);
if (idx_d == string::npos )
cout << "";
string::size_type idx_e;
idx = a.find(f);
if (idx_e == string::npos )
cout << "";
string::size_type idx_f;
idx = a.find(g);
if (idx_e == string::npos )
cout << "";
string::size_type idx_g;
idx = a.find(h);
if (idx_e == string::npos )
cout << "";
string::size_type idx_h;
idx = a.find(i);
if (idx_e == string::npos )
cout << "";
string::size_type idx_i;
idx = a.find(j);
if (idx_e == string::npos )
cout << "";
string::size_type idx_j;
idx = a.find(k);
if (idx_e == string::npos )
cout << "";
string::size_type idx_k;
idx = a.find(l);
if (idx_e == string::npos )
cout << "";
string::size_type idx_l;
idx = a.find(m);
if (idx_e == string::npos )
cout << "";
string::size_type idx_m;
idx = a.find(n);
if (idx_e == string::npos )
cout << "";
string::size_type idx_n;
idx = a.find(o);
if (idx_e == string::npos )
cout << "";
string::size_type idx_o;
idx = a.find(p);
if (idx_e == string::npos )
cout << "";
string::size_type idx_p;
idx = a.find(q);
if (idx_e == string::npos )
cout << "";
string::size_type idx_q;
idx = a.find(r);
if (idx_e == string::npos )
cout << "";
else cout << "存在" << endl;
if (a >= "a" && a <= "z")
a[0] -= 32;
cout << a << endl;
}