C++编译时出错
Error in C++ compiling
所以我刚开始学习基础知识,并尝试对数字进行响应,但它在第10行和第13行给了我一个"std::"绑定错误。这是代码(附言:我认为最后一个花括号被留下了):
#include <iostream>
#include <string>
using namespace std;
int main() {
string name;
int FavNum;
cout << "Hello Sir what is your name" << endl;
cin >> name >> "n";
cout << "Well Hello " << name
<< "What is your Favorite number between 1 and 100" << endl;
cin >> name >> "n";
if (FavNum > 100) {
cout << "Wow you like big numbers, but sorry you cant use that one" << endl;
} else if (FavNum >= 90) {
cout << "Wow you like huge numbers!" << endl;
} else if (FavNum <= 10) {
cout << "Wow you like smaller numbers!!!" << endl;
} else if (FavNum == 13) {
cout << "Wow your favorite number is the most unluckiest number in the "
"whole entire universe and I don't know many people that would "
"choose this number I'm proud comrad"
<< endl;
} else if (FavNum <= 89) {
cout << "You have a very nice number thats average try again!" << endl;
}
}
cin >> name >> "n";
应该是
cin >> name;
在两个地方都使用了它。不能将输入流发送到字符串文字。
相关文章:
- 在Linux for Windows上编译C++代码时出错
- 为x86而非x64编译时出错
- 当我尝试通过 mingw 使用 CMake 和 SFML 库编译项目时出错
- 尝试在Windows上执行C++时出错(通过MinGW编译)
- 如何使用我构建的库,而不会从源代码出错,但不为我自己的项目编译?
- constexpr 使用 clang 编译 TensorFlow 时出错
- 从DLL导出函数,LoadLibrary()需要用TEXT转换的字符串才能编译而不会出错
- 编译包含指向模板函数的指针的初始值设定项列表时,gcc 出错,但 clang 不出错
- 编译时出错 - 从 DWORD 到 LPCVOID 的转换
- 在发布模式下启动使用库的静态链接编译的应用程序时出错
- 编译时出错 - 链接.cpp和头文件
- <limits> 使用 VSC2019 编译旧代码时出错
- 在 ubuntu 焦点上编译虚幻引擎 4.25 时出错
- 编译包含LLVM API标头的C++文件时出错
- 编译以下代码时出错
- 使用交叉工具ng编译gcc时出错
- 在 dll 中为 qLibrary 编译 qobject 时出错
- 使用 cmake 在窗口上编译 c++ 数据库时出错
- 使用 TDM GCC 5.1.0 编译 PDCurses36 时出错
- Lua :在原生lua中编译,但在使用LuaJIT和sol2时C++出错