By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,515 Members | 1,772 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,515 IT Pros & Developers. It's quick & easy.

Create function given prototype.

P: 5
SOMEONE PLS HELP!

im writing this code of a function prototype as follows:
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<iomanip>
  3.  
  4.  
  5. using std::cin;
  6. using std::cout;
  7. using std::endl;
  8. using std::setw;
  9. using std::right;
  10.  
  11. void wecome();
  12.  
  13.  
  14. int main()
  15. {
  16.     void welcome();
  17.  
  18.     return 0;
  19. }
  20.  
  21. int welcome()
  22. {
  23.     int option = 0;
  24.  
  25.     cout<<endl<<endl;
  26.     cout<<"Welcome to Base Hospital Nursing Care Program."<<endl<<endl;
  27.     cout<<"Menu Options:"<<endl;
  28.     cout<<"1."<<setw(6)<<"Classify a Patient."<<endl;
  29.     cout<<"2."<<setw(6)<<"Display Patient Data Summary."<<endl;
  30.     cout<<"3."<<setw(6)<<"Display Staffing Summary."<<endl;
  31.     cout<<"0."<<setw(0)<<"Exit."<<endl;
  32.     cout<<"Select Option:=> ";
  33.     cin>>option;
  34.     return option;
  35. }
however when im runing the program in the commad line window,it just says "press any key to continue..."
this program was running fine until yesterday but mysteriously something ahppened 2day.Im using MICROSOFT VISUAL C++ 2005 EXPRESS EDITION.could something be wrong with the software.
any help would be appreciated.
May 24 '07 #1
Share this Question
Share on Google+
5 Replies


Savage
Expert 100+
P: 1,764
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<iomanip>
  3.  
  4.  
  5. using std::cin;
  6. using std::cout;
  7. using std::endl;
  8. using std::setw;
  9. using std::right;
  10.  
  11. void wecome();
  12.  
  13.  
  14. int main()
  15. {
  16.     void welcome();
  17.  
  18.     return 0;
  19. }
  20.  
  21. int welcome()
  22. {
  23.     int option = 0;
  24.  
  25.     cout<<endl<<endl;
  26.     cout<<"Welcome to Base Hospital Nursing Care Program."<<endl<<endl;
  27.     cout<<"Menu Options:"<<endl;
  28.     cout<<"1."<<setw(6)<<"Classify a Patient."<<endl;
  29.     cout<<"2."<<setw(6)<<"Display Patient Data Summary."<<endl;
  30.     cout<<"3."<<setw(6)<<"Display Staffing Summary."<<endl;
  31.     cout<<"0."<<setw(0)<<"Exit."<<endl;
  32.     cout<<"Select Option:=> ";
  33.     cin>>option;
  34.     return option;
  35. }

Is there anything suspicous to u in bolded lines?

Savage
May 24 '07 #2

P: 5
thanx savage i've corrected the code,my bad i posted the wrong one here is the corrected one,but i still get the same message in the comand line window :
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<iomanip>
  3.  
  4.  
  5. using std::cin;
  6. using std::cout;
  7. using std::endl;
  8. using std::setw;
  9. using std::right;
  10.  
  11. void welcome();
  12.  
  13.  
  14. int main()
  15. {
  16.     void welcome();
  17.  
  18.     return 0;
  19. }
  20.  
  21. void welcome()
  22. {
  23.     int option = 0;
  24.  
  25.     cout<<endl<<endl;
  26.     cout<<"Welcome to Base Hospital Nursing Care Program."<<endl<<endl;
  27.     cout<<"Menu Options:"<<endl;
  28.     cout<<"1."<<setw(6)<<"Classify a Patient."<<endl;
  29.     cout<<"2."<<setw(6)<<"Display Patient Data Summary."<<endl;
  30.     cout<<"3."<<setw(6)<<"Display Staffing Summary."<<endl;
  31.     cout<<"0."<<setw(0)<<"Exit."<<endl;
  32.     cout<<"Select Option:=> ";
  33.     cin>>option;
  34. }
but it still shows the same thing.im very confused.
May 24 '07 #3

Savage
Expert 100+
P: 1,764
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. #include<iomanip>
  3.  
  4.  
  5. using std::cin;
  6. using std::cout;
  7. using std::endl;
  8. using std::setw;
  9. using std::right;
  10.  
  11. void welcome();
  12.  
  13.  
  14. int main()
  15. {
  16.     void welcome();
  17.  
  18.     return 0;
  19. }
  20.  
  21. void welcome()
  22. {
  23.     int option = 0;
  24.  
  25.     cout<<endl<<endl;
  26.     cout<<"Welcome to Base Hospital Nursing Care Program."<<endl<<endl;
  27.     cout<<"Menu Options:"<<endl;
  28.     cout<<"1."<<setw(6)<<"Classify a Patient."<<endl;
  29.     cout<<"2."<<setw(6)<<"Display Patient Data Summary."<<endl;
  30.     cout<<"3."<<setw(6)<<"Display Staffing Summary."<<endl;
  31.     cout<<"0."<<setw(0)<<"Exit."<<endl;
  32.     cout<<"Select Option:=> ";
  33.     cin>>option;
  34. }
Code in bold is not doing what u are expecting from it.U must remove void,becasue compiler thinks that u are creating a new function,not calling it.

(And please use code tags when posting code)

Savage
May 24 '07 #4

P: 5
got it mate,thanx a million,i think something is wrong with my eyes! :)
May 24 '07 #5

Savage
Expert 100+
P: 1,764
got it mate,thanx a million,i think something is wrong with my eyes! :)
U are welcome!

PS:Call a doctor! :)
May 24 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.