problemscpp
A collection of my answers to algorithm problems in c++.
函数
pat::b::b1033 命名空间参考

1033 旧键盘打字 更多...

函数

int main (istream &cin, ostream &cout)
 
 TEST (b1033, case1)
 

详细描述

1033 旧键盘打字

函数说明

◆ main()

int pat::b::b1033::main ( istream &  cin,
ostream &  cout 
)

在文件 pat.cpp1075 行定义.

1075 {
1076 unordered_set<char> broken;
1077 string str1;
1078 string str2;
1079 cin >> str1 >> str2;
1080 if(str2.empty()) {
1081 cout << str1;
1082 return 0;
1083 }
1084 bool shift = true;
1085 for(char ch: str1) {
1086 broken.insert(ch);
1087 if(ch == '+') {
1088 shift = false;
1089 }
1090 }
1091 for(const char ch: str2) {
1092 if(!(broken.contains(toupper(ch)) || !shift && isupper(ch) != 0)) {
1093 cout << ch;
1094 }
1095 }
1096 return 0;
1097 }

被这些函数引用 TEST().

◆ TEST()

pat::b::b1033::TEST ( b1033  ,
case1   
)

在文件 pat_test.cpp489 行定义.

489 {
490 istringstream in("7+IE.\n"
491 "7_This_is_a_test.");
492 auto out = ostringstream();
493 main(in, out);
494 const auto ans = out.str();
495 ASSERT_EQ("_hs_s_a_tst", out.str());
496 }
int main(int argc, char **argv)
Definition: main.cpp:5

引用了 main().