我找不到错误
I can't find the errors
编写一个程序,要求用户输入五个浮点数。程序应该创建一个文件并将所有五个数字保存到(即写入)到文件中。
请问任何人都可以说出这里的错误是什么?
#include <iosream>
#include <fstream>
#include <StdAfx.h>
using namespace std;
int main()
{
float n1,n2,n3,n4,n5;
ofstream numbersfile;
numbersfile.open("C:\x\numbers.txt");
cout<<"enter 5 numbres (will be stored to numbersfile)"<<endl;
cin>>n1 >>n2 >>n3 >> n4 >>n5;
xfile<<n1 <<n2 <<n3 <<n4 <<n5 <<endl;
cout<<" your numbers have been written to numbersfile";
numbersfile.close();
return 0;
}
#include <iosream>
拼写错误。应改为
#include <iostream>
XFILE 从未声明
xfile<<n1 <<n2 <<n3 <<n4 <<n5 <<endl;
应该是
numbersfile<<n1 <<n2 <<n3 <<n4 <<n5 <<endl;
相关文章:
- 静态链接库时,收到链接器错误:找不到 -lgcc_s
- C++ ZBar cmake 错误"找不到文件"时包括
- GTK+3 编译错误"找不到信号处理程序",您是否使用 -rdynamic 进行了编译?
- SWIG c++ 到 C# 错误找不到入口点SWIGRegisterExceptionCallbacks_xxxx
- NDK R20 LD:LD:错误:找不到-lpthread
- 双重释放或损坏错误(找不到错误?
- 错误找不到-lglu
- 错误:找不到匹配的超载函数
- 生成文件错误 - 找不到文件 - *.cpp
- Qt 创建器错误:找不到 -lopencv_imgcodecs
- 无法配置 AGENT++ 配置: 错误: 找不到合适的 libsnmp++ 库
- CMake 错误:找不到变量.ACE_INCLUDE_DIR(高级)
- CMake 包含错误(找不到文件、未定义引用)
- 链接错误:找不到__thiscall函数符号,但定义了__cdecl函数符号
- 运行时错误:找不到与 ImageSensor 匹配的 Python 模块
- 编译错误:找不到库
- CMake错误:找不到包含目录和库
- Mac OSX:构建opencv_contrib致命错误:找不到文件 opencv2/core.hpp
- Qt 创建者编译错误"找不到 UIC.exe从 msvc 2012 路径"
- Ubuntu - 链接 boost.python - 致命错误:找不到 pyconfig