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

1021 个位数统计 更多...

函数

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

详细描述

1021 个位数统计

函数说明

◆ main()

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

在文件 pat.cpp728 行定义.

728 {
729 map<char, int> dm;
730 char ch;
731 while(cin >> ch) {
732 if(isdigit(ch) != 0) {
733 dm[ch]++;
734 }
735 }
736 for(auto [d, m]: dm) {
737 cout << d << ':' << m << endl;
738 }
739 return 0;
740 }

被这些函数引用 TEST().

◆ TEST()

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

在文件 pat_test.cpp312 行定义.

312 {
313 istringstream in("100311");
314 auto out = ostringstream();
315 main(in, out);
316 const auto ans = out.str();
317 ASSERT_EQ("0:2\n"
318 "1:3\n"
319 "3:1\n",
320 out.str());
321 }
int main(int argc, char **argv)
Definition: main.cpp:5

引用了 main().