I am writing a program using a linked list and I am almost to the point where I can compile and run it but I keep on getting this error message: error C2447: missing function header (old-style formal list?). What does it mean? I looked through the code but I cannot find anything wrong with it. Here is the code:
#include<iostream.h>
struct temperature_node
{
int day;
float temperature;
temperature_node *next;
};
temperature_node *head_ptr;
temperature_node *current_ptr;
int get_temp(int days, float &temp);
void show_temps();
void remove_temps();
void add_temp(int days, float temp);
void move_c_to_end();
int main();
{
int days;
float temp;
if(get_temp(days, temp))
{
head_ptr = new temperature_node;
head_ptr->day = days;
head_ptr->temperature = temp;
head_ptr->next = NULL;
while(get_temp(days, temp))
{
add_temp(days, temp);
}
show_temps();
remove_temps();
}
return 0;
}
int get_temp(int days, float &temp)
{
int keep_data = 1;
cout << "enter the days for which you have data ";
cin >> days;
if(days != 0)
{
cout << "enter the temperature ";
cin >> temp;
}
else
{
keep_data = 0;
}
return(keep_data);
}
void add_temp(int days, float temp)
{
temperature_node *new_rec_ptr;
new_rec_ptr = new temperature_node;
new_rec_ptr->day = days;
new_rec_ptr->temperature = temp;
new_rec_ptr->next = NULL;
move_c_to_end();
current_ptr->next = new_rec_ptr;
}
void move_c_to_end()
{
current_ptr = head_ptr;
while(current_ptr->next != NULL)
{
current_ptr = current_ptr->next;
}
}
void show_temps()
{
current_ptr = head_ptr;
do
{
cout << current_ptr->day << endl;
cout << current_ptr->temperature << endl;
} while(current_ptr != NULL);
}
void remove_temps()
{
temperature_node *temporary_ptr;
current_ptr = head_ptr;
do
{
temporary_ptr = current_ptr->next;
delete current_ptr;
current_ptr = temporary_ptr;
}while(temporary_ptr != NULL);
}