【发布时间】:2019-06-28 19:29:15
【问题描述】:
我正在尝试用 C++ 编写一个计算数学符号数量的程序。我正在使用isdigit 来解决这个问题,但是当我传递字符串的值时,它会给我一个警告。
这是我拥有的代码。 digito[i] = entrada[i] 行是我认为问题所在,但我不明白为什么。
cout << "Input the operation" << endl;
cin >> input;
string digit[] = { "" };
string sign[]={""};
int cn = 0, cs = 0;
for (int i = 0; i < input.size(); i++) {
if (isdigit(input[i])) {
cout << "There is a digit in position " << i << endl;
cn += 1;
digit[i] = input[i];
}
else {
cout << "There is a sign in position " << i << endl;
// sign[i] = input[i];
cs += 1;
sign[i] = input[i];
}
}
我把这段代码当作问题:
static _CONSTEXPR17 void assign(char& _Left, const char& _Right) noexcept
{ // assign an element
_Left = _Right;
}
【问题讨论】:
-
英语,请。
-
Hector, lo he convertido a inglés, pero es posible que desees comprobarlo, ya que usé Google Translate, que es notoriamente poco confiable。 Alternativamente, hay un sitio SO en español si prefiere su idioma nativo: es.stackoverflow.com
-
我把它翻译成英文了! @paxdiablo(西班牙语,我的母语)。
标签: c++ arrays c++11 visual-c++