Compile Error

foo.cc: In function 'int main()':
foo.cc:7:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  for(int i=0;i<s.size();++i)
      |              ~^~~~~~~~~
foo.cc:8:6: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
    8 |   if(isupper(s[i]) a++;
      |      ^~~~~~~
foo.cc:8:19: error: expected ';' before 'a'
    8 |   if(isupper(s[i]) a++;
      |                   ^~
      |                   ;
foo.cc:9:2: error: expected primary-expression before 'for'
    9 |  for(int i=0;i<s.size();++i)
      |  ^~~
foo.cc:8:24: error: expected ')' before 'for'
    8 |   if(isupper(s[i]) a++;
      |     ~                  ^
      |                        )
    9 |  for(int i=0;i<s.size();++i)
      |  ~~~                    
foo.cc:8:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    8 |   if(isupper(s[i]) a++;
      |   ^~
foo.cc:9:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    9 |  for(int i=0;i<s.size();++i)
      |              ^
foo.cc:9:14: error: 'i' was not declared in this scope
foo.cc:11:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for(int i=0;i<s.size();++i)
      |              ~^~~~~~~~~
foo.cc:12:6: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17'
   12 |   if(isdigit(s[i]) c++;
      |      ^~~~~~~
foo.cc:12:19: error: expected ';' before 'c'
   12 |   if(isdigit(s[i]) c++;
      |                   ^~
      |                   ;
foo.cc:13:2: error: expected primary-expression before 'for'
   13 |  for(int i=0;i<s.size();++i)
      |  ^~~
foo.cc:12:24: error: expected ')' before 'for'
   12 |   if(isdigit(s[i]) c++;
      |     ~                  ^
      |                        )
   13 |  for(int i=0;i<s.size();++i)
      |  ~~~                    
foo.cc:12:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   12 |   if(isdigit(s[i]) c++;
      |   ^~
foo.cc:13:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   13 |  for(int i=0;i<s.size();++i)
      |              ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1103 字符统计
语言
C++
递交时间
2022-07-18 22:29:02
评测时间
2022-07-18 22:29:02
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes