エラー:WeatherForecaster :: WeatherForecasterのプロトタイプ(すべての変数)がWeatherForecasterのどのクラスとも一致しません " 私は出ていますこれを回避する方法のアイデアの私のメインコードはエラーbtwとは関係ありません。ソースコードの問題を特定するためのヘルプが必要
最新のエラー、残りの修正。私は今、メインの "WeatherForecast :: WeatherForecast()"を呼び出すための関数がありません。変数wf WeatherForecastを作成した後。
出典:
#include "WeatherForecaster.h" //header being included
#include<iostream>
using namespace std;
//error comes here
WeatherForecaster::WeatherForecaster(string d, string fd, int h, int l,
int hum,int avgw, string avgwd, int maxw, string maxwd, double p)
{
string day=d;
string forecastDay=fd;
int highTemp=h;
int lowTemp =l;
int humidity=hum;
int avgWind= avgw;
string avgWindDir=avgwd;
int maxWind=maxw;
string maxWindDir= maxwd;
double recip=p;
}
WeatherForecaster::~WeatherForecaster(){
//dtor
};//end of block of source code
ヘッダー:私は、このような単純なミスを作っています、私はそれが正確に何であるかわかりません。コンストラクタこれらのパラメータを取るあなたの宣言(列D、文字列FD、int型H、int型のL、INTハム、INT avgw、文字列avgwd、int型maxw、文字列maxwd、ダブルp)はヘッダにある
#ifndef WEATHERFORECASTER_H
#define WEATHERFORECASTER_H
#include <iostream>
using namespace std;
//does my code have a problem with how it interacts with this struct?
struct ForecastDay{
std::string day;
std::string forecastDay;
int highTemp;
int lowTemp;
int humidity;
int avgWind;
std::string avgWindDir;
int maxWind;
std::string maxWindDir;
double precip;
};
class WeatherForecaster
{
public://most recent error ") expected before 'd'"
WeatherForecaster(string d, string fd, int h, int l,
int hum,int avgw, string avgwd, int maxw, string maxwd, double p);
~WeatherForecaster();
void addDayToData(ForecastDay);
void printDaysInData();
void printForecastForDay(std::string);
void printFourDayForecast(std::string);
double calculateTotalPrecipitation();
void printLastDayItRained();
void printLastDayAboveTemperature(int); //argument is the
temperature
void printTemperatureForecastDifference(std::string);
void printPredictedVsActualRainfall(int);
std::string getFirstDayInData();
std::string getLastDayInData();
protected:
private:
int arrayLength;
int index;
ForecastDay yearData[984];
};
#endif // WEATHERFORECASTER_H
ヘッダーファイルで 'namespace std;'を使用しないでください。そのヘッダーを思いついた人は、これを行うことによってあなたに何の恩恵も与えません。 – PaulMcKenzie
'std :: string'を' #include 'なしで使用しています。それはあなたに 'd'パラメータのエラーを与えるでしょう。 –