gpt4 book ai didi

c++ - Eclipse C++ - 无法解析字符串类型

转载 作者:太空宇宙 更新时间:2023-11-04 12:08:47 25 4
gpt4 key购买 nike

我正在尝试构建一个头文件 prog1.h,它目前看起来如下:

#ifndef PROG1_H_
#define PROG1_H_

#include <fstream>
#include <string>
#include <cstdlib>
#include <iostream>

using namespace std;

const int NUMGRADES = 5;

struct StudentInfo{
string id;
double avGrade;
int grades[NUMGRADES];
};

int ReadGrades(istream & input, StudentInfo Info[]);

void HighestAverage(StudentInfo Info[], int numStudents, string & id, double & maxAv);

#endif /* PROG1_H_ */

但是,字符串标识符带有下划线并且 Eclipse 提示“字符串无法解析为类型”。我包含了所有内容并且正在使用标准命名空间,那么问题是什么?

谢谢!

最佳答案

尝试执行 std::string 并删除 using。

关于c++ - Eclipse C++ - 无法解析字符串类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10711245/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com