473,757 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create function given prototype.

5 New Member
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
5 2538
Savage
1,764 Recognized Expert Top Contributor
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
cyborg81
5 New Member
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
1,764 Recognized Expert Top Contributor
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
cyborg81
5 New Member
got it mate,thanx a million,i think something is wrong with my eyes! :)
May 24 '07 #5
Savage
1,764 Recognized Expert Top Contributor
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

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

Similar topics

8
3193
by: Steve Neill | last post by:
Can anyone suggest how to create an arbitrary object at runtime WITHOUT using the deprecated eval() function. The eval() method works ok (see below), but is not ideal. function Client() { } Client.prototype.fullname = "John Smith"; var s = "Client"; eval("var o = new " + s + "();"); alert(o.fullname);
6
7995
by: Daniel Nichols | last post by:
I've noticed that in a C module (.c, .h file combination) that if you create a function's definition before it is used in other functions than a declaration is not necessary. I believe if the compiler can find the definition of the function prior to encountering the use of the function it will generate the prototype itself. I don't currently use this feature, I explicitly create declarations for all functions in a header file. However, I...
5
7267
by: Kobu | last post by:
Does anyone know how old style function definitions differ in "behaviour" to new style function definitions? I heard the old style function definitions caused integeral promotion and floating point promotion on the formal parameters. Is this true? Is it okay for me to set up a new style funciton prototype when calling old style function definitions (for legacy code)? Is this okay?
41
2577
by: Telmo Costa | last post by:
Hi. I have the following code: -------------------------------------- function Tunnel() { //arguments(???); } function Sum() { var sum = 0; for (i=0; i<arguments.length; i++) sum += arguments;
20
2373
by: Christian Christmann | last post by:
Hi, in a benchmark I've found an uncommon use of a function. This is the simplified form: 1 int foo( int f ) 2 { 3 return f; 4 } 5
7
3721
by: divya | last post by:
What is an equivalent TimeSerial() function of VBscript in the Java Script?? I have two variables hour and minutes. Timeserial(hour,minutes) returns the time hour : minutes. But I want to do similar thing using the javascript .Can anybody help me out with the procedure. Divya.
28
4336
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
11
2739
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other problems? Of course, I presume that inside f I don't access i in case it was called via g. int f(int i){ /* ... */ return 0; }
2
2355
by: vlsidesign | last post by:
Here is my a portion of my program: #include <stdio.h> main() { int fahr, celsius; int lower, upper, step; int fc_conv(int fahr); ... snip ... }
18
2855
by: sam_cit | last post by:
Hi Everyone, int main() { printf("not included stdio.h"); } Yes, i haven't included stdio.h and my compiler would generate a warning and would assume that it would return a int, my question is how does the linker manage to link the function invocation to the proper
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.