【问题标题】:I get in Visual Studio C++ these errors: 'NuovoUtente': undeclared identifier and 'CercareUtente': undeclared identifier [closed]我在 Visual Studio C++ 中遇到这些错误:“NuovoUtente”:未声明的标识符和“CercareUtente”:未声明的标识符 [关闭]
【发布时间】:2016-12-11 18:27:34
【问题描述】:

我在 Visual Studio C++ 中遇到以下错误:'NuovoUtente': undeclared identifier 和 'CercareUtente': undeclared identifier

如果你现在请回答我为什么会收到这些错误。

这是我的代码:

【问题讨论】:

  • 在此处发布您的代码,而不是图片
  • 您必须先声明每个变量,然后才能使用它。

标签: c++ visual-studio compiler-errors undeclared-identifier


【解决方案1】:

这些错误看起来很合理,因为您从未在程序的任何地方定义过这些值。在您的程序中,您似乎正在尝试让用户输入一个字符串,然后检查他们是否输入了一段特定的文本,但现在您正在读取一个 number 然后比较它针对一个不存在的变量。你的意思是这样的吗?

string input;
getline(cin, input);

if (input == "NuovoUtente") { // Note the == and the quotation marks
    ...
} else if (input == "CercareUtente") {
    ...
}

【讨论】:

  • getline 和 input 包含哪个库?
  • 它在<string> 标头中。如果您以前没有看过它们,我建议您阅读有关该语言的优秀教程。
猜你喜欢
  • 1970-01-01
  • 2018-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多