| | |
error C2447: missing function header (old-style formal list?), what does this mean?!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
error C2447: missing function header (old-style formal list?), what does this mean?!
0
#1 Dec 16th, 2004
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:
C++ Syntax (Toggle Plain Text)
#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); }
•
•
Join Date: Dec 2004
Posts: 24
Reputation:
Solved Threads: 1
Re: error C2447: missing function header (old-style formal list?), what does this mea
0
#2 Dec 16th, 2004
http://www.freewebs.com/yb2pls/index.htm
view my site http://www.freewebs.com/yb2pls/index.htm
and sign the guest book
C++ Syntax (Toggle Plain Text)
#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); }
view my site http://www.freewebs.com/yb2pls/index.htm
and sign the guest book
Last edited by alc6379; Dec 17th, 2004 at 11:17 am. Reason: added [code] tags
Re: error C2447: missing function header (old-style formal list?), what does this mea
0
#3 Dec 16th, 2004
•
•
•
•
Originally Posted by the b
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.
int main();
{Re: error C2447: missing function header (old-style formal list?), what does this mean?!
0
#4 Dec 16th, 2004
I have a code snippet about singly / doubly linked lists if you run into any more trouble. Watch out for <iostream.h>, it should be 'updated' to
as ive heard not all compilers / OS whatever support <iostream.h> anymore as it is non standardised!
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std;
as ive heard not all compilers / OS whatever support <iostream.h> anymore as it is non standardised!
http://sales.carina-e.com
no www
no nonsense
coming soon to a pc near you! :cool:
no www
no nonsense
coming soon to a pc near you! :cool:
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
Re: error C2447: missing function header (old-style formal list?), what does this mean?!
0
#5 Dec 17th, 2004
Ok, I have made a few modifications and the program actually runs; but only to a certain point. Just so you have an idea, this program is supposed to consist of asking the user for the number of days that he\she has temperatures for and putting them in a linked list. when I display them at the end of the program the average temperature is suposed to be calculated also. I do not have anything that calculates the average as of yet but I'm not to worried. The problem I seem to be having now is that nodes are not being added. I think it is because of something in the get_temp function. any help is greatly appreciated. Here is the code:
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; struct temperature_node { int day; float temperature; temperature_node *next; }; temperature_node *head_ptr; temperature_node *current_ptr; int day_counter = 0; 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 = 0; 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; if(days <= 0) { cout << "enter the number of days for which you have temperatures "; cin >> days; } while(day_counter != days) { cout << "Enter temperature for day " << day_counter + 1 << endl; cin >> temp; day_counter++; } if(day_counter == days) { 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); }
Re: error C2447: missing function header (old-style formal list?), what does this mean?!
0
#6 Dec 18th, 2004
•
•
•
•
this program is supposed to consist of asking the user for the number of days that he\she has temperatures for and putting them in a linked list.
C++ Syntax (Toggle Plain Text)
data_type *data; // data_type is your data type (char/int/long ect....) data = (data_type*)new data_type[size]; // size is the number of elements delete [] data; // when you have finished with it delete it!
http://sales.carina-e.com
no www
no nonsense
coming soon to a pc near you! :cool:
no www
no nonsense
coming soon to a pc near you! :cool:
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
Re: error C2447: missing function header (old-style formal list?), what does this mea
0
#7 Dec 18th, 2004
Yes, actually this is an assignment, :o but I don't want anybody to do it for me, I just need some hints. As you can probably tell I am very new at this, and I would not be posting here because I know that it is somewhat annoying to have everybody wanting someone else to do their homework for them. However I have a matter of days to get this done and I spend all my time on the computer working on it. The requirements for the program are: to write a program using a linked list that prompts the user for the days and temperatures and then calculates the average temperature. I have modified the get_temp function from the last post, and now the output displays the last day and the first temperature.
Here is the modified section of code:
Here is the modified section of code:
C++ Syntax (Toggle Plain Text)
int get_temp(int days, float &temp) { int keep_data = 1; if(day_counter == days) { keep_data = 0; } else { days = day_counter + 1; // note that day_counter is a global variable cout << days; cout << "enter the temperature for day " << day_counter + 1 << endl; cin >> temp; day_counter++; } return(keep_data); }
Last edited by alc6379; Dec 20th, 2004 at 1:53 pm.
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
Re: error C2447: missing function header (old-style formal list?), what does this mean?!
0
#8 Dec 19th, 2004
I do not know if anyone is even paying attention to this thread anymore but I found something wrong with the program nevertheless. In my show_temps function I forgot to add current_ptr = current_ptr->next; . That explains ALOT. Anyway, the program now displays all the temperatures the user adds but it only displays the last day. For example: Day: Temperature:
3 10
3 20
3 32.2
any ideas on how to fix this would be appreciated. If there is anyone out there reading this and they do not mind helping me, here is newest version of source code:
Thanx
3 10
3 20
3 32.2
any ideas on how to fix this would be appreciated. If there is anyone out there reading this and they do not mind helping me, here is newest version of source code:
C++ Syntax (Toggle Plain Text)
#include<iostream.h> struct temperature_node { int day; float temperature; temperature_node *next; }; int day_counter = 0; 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; cout << "enter the days for which you have data "; cin >> days; if(get_temp(days, temp)) { head_ptr = new temperature_node; head_ptr->day = day_counter; 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; if(day_counter == days) { keep_data = 0; } else { days = day_counter + 1; cout << days; cout << "enter the temperature for day " << day_counter + 1 << endl; cin >> temp; day_counter++; } 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 << " "; cout << current_ptr->temperature << endl; current_ptr = current_ptr->next; } 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); }
Thanx
Re: error C2447: missing function header (old-style formal list?), what does this mean?!
0
#9 Dec 20th, 2004
•
•
•
•
I forgot to add current_ptr = current_ptr->next;
http://sales.carina-e.com
no www
no nonsense
coming soon to a pc near you! :cool:
no www
no nonsense
coming soon to a pc near you! :cool:
•
•
Join Date: Sep 2004
Posts: 42
Reputation:
Solved Threads: 0
Re: error C2447: missing function header (old-style formal list?), what does this mean?!
0
#10 Dec 20th, 2004
Yeah the whole current pointer bit made me feel pretty stupid. :o Anyway the program is still not displaying the proper day. I really appreciate the help you have been giving me, and I just wanna say thanx. If you do not really want to go through my code that is cool because I think I'll figure it out eventually, but if you do happen to go through it and find something you can give me a hint on that's even cooler
I now can only get the last day to display and not any of the others.
thanx again
I now can only get the last day to display and not any of the others. thanx again
![]() |
Similar Threads
- error C2447: '{' : missing function header (old-style formal list?) (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C)
- error C2447: '{' : missing function header (old-style formal list?) please help. (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C++)
Other Threads in the C++ Forum
- Previous Thread: Deitel's "C++ How To Program" exercise 2.18
- Next Thread: Keyboard Error Handling
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






