-5
如果有人能帮我找出为什么这个错误发生,我会非常高兴。我觉得我的代码应该编译但我得到这个错误与我的两个无效函数。错误LNK2019 - 我觉得我的代码应该编译,但得到这个错误
这里是我的代码...
#include<iostream>
#include<iomanip>
#include<fstream>
using namespace std;
// global constant variables
const int YEARS = 8;
const int MONTHS = 12;
const int SPACER =5;
// function prototypes
// function to read in values
void getData(double[][MONTHS], int[]);
// function to display values in table format
void printData(double[][MONTHS], int[]);
// function to print data to screen in table format using arrays
int main()
{
double rain [YEARS][MONTHS];
int years[YEARS];
getData(rain, years);
printData(rain, years);
return 0;
}
// function definitions
void getData (double rainArray[][YEARS], int yearArray[])
{
ifstream fin;
fin.open("rainfall.txt");
if (!fin)
{
cout << "Error opening file, shutting down now.\n" ;
exit(EXIT_FAILURE);
}
else
{
for(int i = 0; i < YEARS; i++)
{
fin >> yearArray[i];
for (int j = 0; j < MONTHS; j++)
{
fin >> rainArray[i][j];
}
}
}
fin.close();
}
void printData (double rainArray[][YEARS], int yearArray[])
{
for (int i = 0; i < YEARS; i++){
cout << yearArray[i] << setw(SPACER);
for (int j = 0; j < MONTHS; j ++)
cout << rainArray[i][j] << setw(SPACER);
}
cout << endl;
}
错误信息究竟是什么?您能否请包括* actual *错误信息以及可能导致这些错误的行(如果适用)。 – 2013-04-23 02:21:52
你看过那个错误是什么意思吗? – 2013-04-23 02:24:57
这些功能在哪里实现? – 2013-04-23 02:27:51