1 个回答
dagadhg
回答于 2024-07-20
已采纳
提问:对于我那个代码,为什么编译错误?
//显示编译错误,那是有什么问题哎?#include <iostream>#include <algorithm>#include <string>using namespace std;int main(){ string a,b; int lena,lenb; while(cin>>a) { cin>>b; int count=0; for(int i=0;a[i]!='\0';i++) { if(b==a.substr(i,b.length())) { count++;}}cout<<count<<endl;} return 0;}
网友回答:
你程序做为C++,没有任何语法问题,不存在编译错误
以下是测试结果

最可能的问题你用错编译器了(上面的是C++的,不能用C或其它编译器的)
我来回答
相关问题
1
回答
游戏王卡组推荐
单机游戏
567 浏览