C ++错误:无法调用'(std :: string {aka std :: basic_string})(std :: string&,std :: string&)'

时间:2015-10-18 10:29:21

标签: c++ string function

编译代码时出现此错误

  

错误:与‘(std::string {aka std::basic_string<char>}) (std::string&, std::string&)’

的来电不匹配

使用字符串

减去两个大数字是一个C ++代码
#include<iostream>
#include<string>
#include<string.h>
#include<cstdlib>
#include<algorithm>

using namespace std;

string diff(string& top,string& bott)
{
string revout,out;
reverse(top.begin(),top.end());
reverse(bott.begin(),bott.end());
   for(unsigned int i=bott.size();i<top.size()-1;i++){bott[i]='0';}
   for(unsigned int i=0;i<bott.size()-1;i++)
   {
    if(top[i]>=bott[i]){revout[i]=top[i]-bott[i];}
    else
    {
     top[i+1]--;
     top[i]=top[i]+10;
     revout[i]=top[i]-bott[i];
    }
   }
   reverse(revout.begin(),revout.end());
   return revout;
}
int main()
{
string sum,excess;
cin>>sum;
cin>>excess;
cout<<diff(sum,excess)<<endl;
return 0;
}

请帮忙。

0 个答案:

没有答案