I'm writing a short program to convert a string (consisting of numbers) to an integer.
(我正在编写一个简短的程序,将字符串(由数字组成)转换为整数。)
The code runs ok but I keep getting an odd intellisense error on the "int" part of the int main()
declaration. (代码运行正常,但在int main()
声明的“ int”部分上不断出现奇怪的intellisense错误。)
The error text is: this declaration has no storage class or type specifier
and shows the first two letters (the "in") in white and the last (the "t") in the yellow that recognized function names are usually tagged with. (错误文本为: this declaration has no storage class or type specifier
并以白色显示前两个字母(“ in”),以黄色显示最后一个字母(“ t”),通常以识别的函数名称对其进行标记。)
Does anyone know what this might be?
(有谁知道这可能是什么?)
Is it just an intellisense anomaly or is there something wrong with my code? (仅仅是智能感知异常还是我的代码有问题?)
Here's the full code listing:
(这是完整的代码清单:)
#include <iostream>
#include <string>
int stringConvert(std::string);
int main()
{
std::string str("123");
int stringNum = stringConvert(str);
std::cout << str << " --> " << stringNum << std::endl;
return 0;
}
int stringConvert(std::string stringIn)
{
int n = std::stoi(stringIn);
std::cout << "String conversion completed" << std::endl;
return n;
}
ask by Christian McCormack translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…