472,354 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

error: call of a non function

17
Hi!
I'm suppode to write a prg to calculate maximum and minimum of 4 intergers by using functions
i've writen the code but getting the error: call of a non function..cant see my error help me..here is my code

#include<iostream.h>
#include<conio.h>
void max(int a,int b,int c,int d);
void min(int a,int b,int c,int d);
int num1,num2,num3,num4,max_val,min_val;
void main()
{clrscr();
int num1,num2,num3,num4,max,min;
cout<<"Input 4 integer values"<<endl;
cin>>num1>>num2>>num3>>num4;

max(num1,num2,num3,num4);

min(num1,num2,num3,num4);

getch();
}

void max(int a,int b,int c,int d)
{ max_val=a;
if (b>max_val)
max_val=b;
if (c>max_val)
max_val=c;
if (d>max_val)
max_val=d;
cout<<"The maximum integer value is:"<<max_val<<endl;
}

void min(int a,int b,int c,int d)
{ min_val=a;
if (b<min_val)
min_val=b;
if (c<min_val)
min_val=c;
if (d<min_val)
min_val=d;
cout<<"The minimum integer value is:"<<min_val<<endl;
}

Same error when am dong another program for calculating the average of 4 integers..
here is my code

#include<iostream.h>
#include<conio.h>
float avg(int a,int b,int c,int d);
void main()
{clrscr();
int w,x,y,z;
float avg;
cout<<"Input four numbers"<<endl;
cin>>w>>x>>y>>z;
cout<<"The average of the four numbers is:"<<avg(w,x,y,z)<<endl;
}
float avg(int a,int b,int c,int d)
{float p;
p=(a+b+c+d)/4;
return p;
}

plz help me find my error
thx alot
Nov 19 '06 #1
1 6625
horace1
1,510 Expert 1GB
in main() you define two local variables max and min which 'hide" the functions max() and min(), when you attempt to call the functions
Expand|Select|Wrap|Line Numbers
  1. max(num1,num2,num3,num4);
  2. min(num1,num2,num3,num4);
  3.  
the compiler thinks you are calling the local variables as though they are functions

remove the max and min local variables and the program works.
Nov 19 '06 #2

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

Similar topics

12
by: Xeon | last post by:
Hi, Is there anyway to set a custom error handler which is actually a method of a class? i.e. setting the method eh() of class foo as error handler in the snippet below. class foo { function...
5
by: Bob Bamberg | last post by:
Hello All, I have been trying without luck to get some information on debugging the Runtime Error R6025 - Pure Virtual Function Call. I am working in C++ and have only one class that is derived...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
5
by: Kurt Van Campenhout | last post by:
Hi, I am trying to get/set Terminal server information in the active directory on a windows 2000 domain. Since the ADSI calls for TS don't work until W2K3, I need to do it myself. I'm fairly...
6
by: Ken | last post by:
When running a program in the debugger, what would cause it to crash without any error messages? I get "The program has exited with code 0 (0x0)". The program is a MDI app with threading for...
1
by: mario.zoric | last post by:
Hi to all! I have one big problem. I have written some code and I want to program at the end looks good but theres one uninspected error. What's going on? I have written code for programm that...
1
by: sathyp | last post by:
Public Function SetPrinterDefaultsW(ByVal sPrinterName As String, _ ByVal nPaperSize As Long, ByVal nOrientation As Long) As Boolean Dim Prn As Printer Dim hPrinter As Long Dim pd As...
0
by: spmanoj78 | last post by:
Hi, I am trying to install DB2 v8.2 on RHEL 5 in silient mode. Can anybody help me out. The Same DB2 v8.2 works fine on SUSE 10. ##################################################### ...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.