i am passing a float and a integer into the function
error: function does not take 1 arguments - #include <stdio.h>
-
#include <stdlib.h>
-
#include <string.h>
-
-
#define AgentSize 5
-
void DisplayWelcome(void);
-
void Type(int);
-
void category();
-
void Budget(float);
-
-
int main()
-
{
-
char Agentfinitial[AgentSize], Agentlinitial[AgentSize];
-
int i=0, AType[AgentSize], MaxAgent[AgentSize]={0};
-
int AgentType[AgentSize]={0};
-
float ibudget[AgentSize], excess[AgentSize]={0}, totmissionbudget[AgentSize]={0};
-
int Agent[AgentSize]={0}, Agentctr[AgentSize]={0};
-
char cat;
-
-
-
-
DisplayWelcome();
-
for (i=0; i<AgentSize; i++)
-
{
-
printf("\nPlease enter first and last initial\n");
-
scanf("%c%c", &Agentfinitial[AgentSize], &Agentlinitial[AgentSize]);getchar();
-
-
printf("\nPlease enter Agent Type\n");
-
scanf("%d", &AType[AgentSize]);getchar();
-
Type(AType[AgentSize]);
-
-
printf("\nYou are allowed an additional 5%% of your budget\n");
-
printf("\nPlease enter budget\n");
-
scanf("%f", &ibudget[AgentSize]); getchar();
-
Budget(ibudget); <<AT THIS POINT
THIS IS THE FUNCTION: - void Budget(float ibudget[AgentSize],int AType[])
-
-
{
-
float excess[AgentSize]={0}, totmissionbudget[AgentSize]={0};
-
-
if (AType[AgentSize]==1)
-
{
-
-
excess[AgentSize] = ibudget[AgentSize]* 0.05;
-
totmissionbudget[AgentSize]= excess[AgentSize] + ibudget[AgentSize];
-
printf("\nThe total mission budget is %f", totmissionbudget[AgentSize]);
-
}
-
else if(AType[AgentSize]==2)
-
{
-
printf("\n This agent is not allowed an excess\n");
-
totmissionbudget[AgentSize] = ibudget[AgentSize] + totmissionbudget[AgentSize];
-
printf("\nThe total mission budget is %f", totmissionbudget[AgentSize]);
-
}
-
-
else if (AType[AgentSize]==3)
-
{
-
printf("\nThis Agent will incur a 5%% penalty if overbudget\n");
-
totmissionbudget[AgentSize] = ibudget[AgentSize]+totmissionbudget[AgentSize];
-
printf("\nThe total mission budget %f", totmissionbudget[AgentSize]);
-
}
-
-
else
-
{
-
Printf("\nYou need to enter a budget\n");
-
}
-
-
-
}//end budget function
1 1421 donbock 2,426
Recognized Expert Top Contributor - void Budget(float);
-
...
-
float ibudget[AgentSize];
-
...
-
Budget(ibudget);
-
...
-
void Budget(float ibudget[AgentSize],int AType[]) {
-
...
-
}
Your prototype says Budget has a single float argument; you pass an array of floats when you call Budget; and you define Budget with two arguments: an array of float and an array of int. The compiler doesn't like inconsistencies like these.
By the way, the compiler doesn't enforce any particular size for array arguments so specifying the size of the ibudget array in the declaration doesn't accomplish anything. Refer to Arrays Revealed for advice on how to pass arrays to functions.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: dave.harper |
last post by:
I'm relatively new to C++, but have a question regarding functions and
arrays. I'm passing a relatively large array to a function several
thousand times during the course of a loop, and it seems to get bogged
down. Do the arrays previously passed to the function stay memory
resident? If not, what's causing it and what can I do to correct it?
Thanks,
Dave
|
by: WindAndWaves |
last post by:
Hi Folks
I know that this is possible:
Function tt(x as string, nv())
where NV is an array.
What I am wondering is if NV can be a multidimensional array.
|
by: Sascha Herpers |
last post by:
Hi,
I wrote a c dll with a type library to use it in vb. No problem,
everything works fine.
Now I needed to pass an array of type double to the dll. I defined the
function in the type library like this:
double VBEXPORT aigIGApproximation( double intervalCount,
|
by: Thomas Christmann |
last post by:
Hi!
Sorry for the weird topic, I don't know how to describe it better...
I have a little problem here I can't wrap my mind around. If I do:
-------------------------------------
#define DWORD unsigned long
#include <stdio.h>
#include <malloc.h>
|
by: nickolais909 |
last post by:
Hello,
I have an old C++ DLL that I am wishing to use in a VB.NET program.
Previously I had a VB6 program that would pass a Type to a DLL
function. For example, I would pass a variable of this Type in:
Public Type ListInfo ' structure to hold information about the list
file
FileIndex As Integer
filename(MAXNAME) As Byte
FileNum As Integer
| |
by: sparkid |
last post by:
I need immediate help in writing a function program. I have to write a
program in functions and use array to store them. I am not familiar
with functions and i tried to create it but i fails to run, However, i
simply created this program in arrays and it runs good except i cant
figure out how to compute the standard deviation. The coding is below.
Any help will be appreciated.
1) The Program will prompt the user for six grades to be...
|
by: canteyn |
last post by:
Ok here is my problem. I am coding a program that uses 3 different functions, and the end result is that the program reads in (x,y) points from a file, and then outputs those points to another file, and then calculates the area of the points(which form a polygon). I am able to compile the program just fine, but every time I try and run the program I just get a "segmentation fault". It may be in regards to my arrays, in fact I am almost sure...
|
by: Nkhosinathie |
last post by:
hi, i'm writing a program that is using 4 arrays of pointers to char,called article,noun,verb and preposition.the program should create a sentence by selecting a word at random from each array in the following order:article,noun,verb preposition,,article and noun.as each word is picked,it should be concatenated to the previous words in an array that is large enough to hold the entire sentence. the words should be separated by spaces.when the...
|
by: S. |
last post by:
Hi all,
Can someone please help me with this?
I have the following struct:
typedef struct {
char *name;
int age;
} Student;
|
by: nigelmercier |
last post by:
I'm still not comfortable with passing character arrays, and I think this is the problem with this code:
char * formatHours(int decimin)
{ // convert integer deci-mins (6 seconds) to string: "XXhYYm"
byte hrs, mins ;
char time ; // global scratch variable txt4 is also char
hrs = decimin / (60 * 10) ; // convert 1/10s of a minute into hours
mins = decimin % (60 * 10) ; // remainder of same division is minutes
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |