Compile Error

foo.cc: In function 'void mycopy(char*, char*, int, int)':
foo.cc:31:8: warning: statement has no effect [-Wunused-value]
   31 |   s1[k]==s2[i];
      |   ~~~~~^~~~~~~
foo.cc: In function 'int count(char*, int, char*, int*)':
foo.cc:39:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   39 |  for(i=0;i<n2-n1+1;i++)
      |                  ^
foo.cc: In function 'int main()':
foo.cc:67:23: error: no matching function for call to 'count(char [100], int&, char [100], int&)'
   67 |    num=count(t,L,s2,n2);
      |                       ^
foo.cc:36:5: note: candidate: 'int count(char*, int, char*, int*)' <near match>
   36 | int count(char s1[],int n1,char s2[],int n2[])
      |     ^~~~~
foo.cc:36:5: note:   conversion of argument 4 would be ill-formed:
foo.cc:67:21: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   67 |    num=count(t,L,s2,n2);
      |                     ^~
      |                     |
      |                     int
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from foo.cc:1:
/usr/include/c++/9/bits/stl_algo.h:4113:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits<_Iterator>::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4113 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/9/bits/stl_algo.h:4113:5: note:   template argument deduction/substitution failed:
foo.cc:67:23: note:   deduced conflicting types for parameter '_IIter' ('char*' and 'int')
   67 |    num=count(t,L,s2,n2);
      |                       ^
foo.cc:53:10: warning: unused variable 'n1' [-Wunused-variable]
   53 |  int num,n1,n2,L,k,n,i;
      |          ^~
foo.cc:57:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   57 |   scanf("%d",&x);
      |   ~~~~~^~~~~~~~~
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1159 最长重复子串
语言
C++
递交时间
2022-05-15 18:54:36
评测时间
2022-05-15 18:54:36
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes