| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 150998 | 陈棋 | 字母概率 | C++ | Compile Error | 0 MS | 0 KB | 395 | 2026-04-02 17:28:51 |
#include<bits/stdc++.h> using namespace std; //bool isVowel(char c){ // c=tolower(c); // return c=='a'||c=='e'||c=='i'||c=='o'||c=='u'; //} int main(){ char c; string s; while(cin>>c>>s){ char tar=tolower(c); int cnt=0; int len=s.size;(); for(char ch:s){ if(tolower(ch)==tar){ cnt++; } } double p==1.0*cnt/len; printf("%.5f\n",p); } return 0; }
Main.cc: In function 'int main()':
Main.cc:13:13: error: cannot convert 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size, std::allocator >' from type 'std::__cxx11::basic_string::size_type (std::__cxx11::basic_string::)() const noexcept {aka long unsigned int (std::__cxx11::basic_string::)() const noexcept}' to type 'int'
int len=s.size;();
^
Main.cc:13:19: error: expected primary-expression before ')' token
int len=s.size;();
^
Main.cc:19:11: error: expected initializer before '==' token
double p==1.0*cnt/len;
^
Main.cc:20:19: error: 'p' was not declared in this scope
printf("%.5f\n",p);
^
Main.cc:13:7: warning: unused variable 'len' [-Wunused-variable]
int len=s.size;();
^