假设有一个像这样的字符串
string temp2 = "hello";
char[] m = { 'u','i','o' };
Boolean B = temp2.Compare(m);
Run Code Online (Sandbox Code Playgroud)
我想检查字符串是否包含我的字符数组?我正在尝试,但它没有采取.在编译消息
temp2.Compare(m)应该是String类型
来了.意味着它遵循string.compare(string); 我希望不应该有某种方式来做到这一点.
编辑//
我已经更正了String.Compare行返回布尔值
我正在尝试这种技术,但错误即将来临.请帮我将数字从字符串转换为整数.
#include<iostream>
using namespace std;
int main()
{
char *buffer[80];
int a;
cout<<"enter the number";
cin.get(buffer,79);
char *ptr[80] = &buffer;
while(*ptr!='\0')
{
a=(a*10)+(*ptr-48);
}
cout<<"the value"<<a;
delete ptr[];
return 0;
}
Run Code Online (Sandbox Code Playgroud)
错误是: