百家姓(2)
嘿嘿,百家姓第二篇来了,今天多更新好像是56个姓吧。
先上代码:
#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::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 << "";
else cout << "存在" << endl;
if (a >= "a" && a <= "z")
a[0] -= 32;
cout << a << endl;
}
嘿嘿,我又来了