视觉C 编译错误
Visual C++ Compile Error
我有时间在这个程序上。我正在使用一个数据文件,该数据文件有12行,每月一条,一个月后的数字位置为2个。示例:
1月9日11
我基本上将月份的名称删除到前3个字母,将它们转换为大写,并引入数字(整数)与它们合作。我正在使用vs 2012,并且一旦我输入" infile>> student.numboys"行,我就会遇到这个喧闹的编译错误:采用" int [2]'类型的右手操作数(或没有可接受的转换)"
自然,我什至没有开始使用数据文件。我已经去了几个小时,所以我要看一段时间了。如果我缺少明显的明显的东西,请对我柔软。
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <assert.h>
using namespace std;
using namespace System;
struct TStudent { char month[10];
int numBoys[2];
int numGirls[2];
int sumStudents[2];
int totBoys[3];
int totGirls[3];
int totStudents[3];
};
const char* AUTHOR = "Sally George Assignment #1 nn";
int i;
void main() {
TStudent Student;
Console::Clear();
cout << AUTHOR;
ifstream Infile("P01.DAT");
assert(Infile);
for (i=1; i<=12; i++)
{ Infile.get(Student.month, 4);
Infile.ignore(1);
// Infile >> Student.numBoys;
strupr(Student.month);
cout << Student.month << endl;
Infile.ignore(80, 'n');
}
}
您可能需要单独输入数组元素,例如:
Infile >> Students.numBoys[0];
Infile >> Students.numBoys[1];
std。除char
数组外,C 不为数组定义>>
操作员。
相关文章:
- 用MacOS Mojave编译C++:致命错误:mpi.h:没有这样的文件或目录
- std::is_base_of表示ctor编译错误
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 在没有定义返回类型的函数中返回布尔值,并将结果保存在无错误的char编译中-为什么
- Qt5:使用QCommandLineParser类时出现奇怪的编译错误
- Qt Cmake 错误编译"GuiSupportQt not found"
- Opengl 精度转换错误编译错误 E0415
- 库将ARM架构错误编译为架构X64
- RT 音频 Mac 错误 g++ 编译错误
- 错误编译Boost.log
- 错误编译QT创建者 / QT窗口小部件示例
- 错误编译MIPS32
- Visual Studio 2013 中的错误(编译和运行代码)
- 链接错误编译qt项目在visual 2010
- 无法用模板错误编译nsgmls
- 奇怪的错误.编译失败
- 如果有人调用c++中的方法,则强制错误(编译时)
- 来自autoconf测试的错误编译命令
- 时间限制超出错误C++编译
- SFML 2.3 和 CodeBlocks 错误编译