65,210
社区成员
发帖
与我相关
我的任务
分享#include<iostream>
using namespace std;
int main()
{
typedef bool (*cmpFcn)(const string &str1,const string &str2);
bool lengthCompare(const string &str3,const string &str4);
string::size_type sumLength(const string &str5,const string &str6);
bool cstringCompare(char*,char*);
cout<<"Hello world!"<<endl;
cmpFcn pf=lengthCompare;
lengthCompare("hi","bye");
pf('hi","bye");
(*pf)("hi","bye");
cout<<pf1<<endl;
cout<<*pf1<<endl;
}
bool lengthCompare(const string &str3,const string &str4)
{
if(str3.size()<str4.size())
return 1;
else
return 0;
}
string::size_type sumLength(const string &str5,const string &str6)
{
if(str5.size()>str6.size())
return 1;
else
return 0;
}
#include<iostream>
#include<string>
using namespace std;
int main()
{
typedef bool (*cmpFcn)(const string &str1,const string &str2);
bool lengthCompare(const string &str3,const string &str4);
bool cstringCompare(char*,char*);
cout<<"Hello world!"<<endl;
cmpFcn pf=lengthCompare;
lengthCompare("hi","bye");
bool a=pf("hi","bye");
bool b=(*pf)("hi","bye");
cout<<a<<endl;
cout<<b<<endl;
}
bool lengthCompare(const string &str3,const string &str4)
{
if(str3.size()<str4.size())
return 1;
else
return 0;
}
#include<iostream>
using namespace std;
int main()
{
typedef bool (*cmpFcn)(const string &str1,const string &str2);
bool lengthCompare(const string &str3,const string &str4);
bool cstringCompare(char*,char*);
cout<<"Hello world!"<<endl;
cmpFcn pf=lengthCompare;
lengthCompare("hi","bye");
pf('hi","bye");
(*pf)("hi","bye");
cout<<pf<<endl;
cout<<*pf<<endl;
}
bool lengthCompare(const string &str3,const string &str4)
{
if(str3.size()<str4.size())
return 1;
else
return 0;
}