Unresolved externals error
I ave no idea how to fix this error any help would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
//Libraries
#include <iostream>
#include <string>
using namespace std;
//Structure
struct months
{
float rain;
float high;
float low;
float average;
};
enum mont{January, Febreuary, March, April, May, June, July, August, September,October, November, December
};
void output(int);
//Main begins here
int main()
{
//Declare variables
const int month= 12;
months total[month];
float totalRain=0;
int highest = 0;
int lowest = 0;
float totalAve = 0;
mont day;
//loop to find rain and temps
for(day=January; day<12; day=static_cast<mont>(day+1)){
output(day);}
for(int i=0;i<12;i++){
cout << endl;
cout << "Enter total rain for this month: ";
cin >> total[i].rain;
cout << endl;
cout << "Enter the highest temperature for this month: ";
cin >> total[i].high;
//input validation
while(total[i].high<-100||total[i].high>140)
{
cout << endl;
cout<<"Invalid entry-must be between -100 through 140\n";
cout<<"high temperature: ";
cin>>total[i].high;
cout << endl;
}
cout << endl;
cout << "Enter the lowest temperature for this month: ";
cin >> total[i].low;
//Input validation
while(total[i].low<-100||total[i].low>140)
{
cout << endl;
cout<<"Invalid entry-must be between -100 through 140\n";
cout<<"high temperature: ";
cin>>total[i].low;
cout << endl;
}
//Calulate the average temperature
cout << endl;
cout << endl;
total[i].average = (total[i].high+total[i].low)/2;
cout <<"The avearge temperature of this month is: " << total[i].average << " degrees";
cout << endl;
cout << endl;
totalRain+=total[i].rain;
totalAve +=(total[i].average)/12;
if(total[i].high>total[highest].high)
{
highest=i;
}
if(total[i].low <total[lowest].low)
{
lowest=i;}
}
//output
cout << endl;
cout << "The total rainfall for the year was: " << totalRain <<" inches"<<endl;
cout << "The highest temperature was: "<<total[highest].high <<" degrees" << endl;
cout << "The lowest temperature was: "<< total[lowest].low<< " degrees" <<endl;
cout <<"The average temerature fot the year is: " << totalAve << " degrees" << endl;
system("PAUSE");
return 0;
}
void output(mont n)
{
switch(n)
{
case January : cout << " January";
break;
}
}
|
Line 17:
Line 100:
The prototype says the function takes an
int
parameter,but the definition says it takes a
mont
.
Keep them consistent -
mont
on both lines, and it should be fine.
I didn't even notice that, thanks helped a lot.
Topic archived. No new replies allowed.