# help with c++

8 replies to this topic

### #1benji

New Member

• Members
• 5 posts

Posted 18 March 2010 - 08:27 PM

hey guys come into a major problem with my code, im having problems with compyling my code but i keep getting the error message C2660 and that i dont have an argument which im sure i have, any help needed

double planeSimulation::lapseRate=LAPSERATE;
double planeSimulation::seaLevelAirPressure=SEALEVELPRESSURE;
double planeSimulation::seaLevelTemp=SEALEVELTEMP;

double planeSimulation::airDensity()
{
double pressure;
if(planeSimulation::lapseRate==0);
{
pressure=(planeSimulation::seaLevelAirPressure*exp(-(0.0342*double()/planeSimulation::seaLevelTemp)));

return 0.003484*planeSimulation::seaLevelAirPressure/planeSimulation::seaLevelTemp;
}

}


### #2benji

New Member

• Members
• 5 posts

Posted 18 March 2010 - 08:29 PM

hey guys come into a major problem with my code, im having problems with compyling my code but i keep getting the error message C2660 and that i dont have an argument which im sure i have, any help needed

double planeSimulation::airDensity()
{
double pressure;
if(planeSimulation::lapseRate==0);
{
pressure=(planeSimulation::seaLevelAirPressure*exp(-(0.0342*(height)/planeSimulation::seaLevelTemp)));

return 0.003484*planeSimulation::seaLevelAirPressure/planeSimulation::seaLevelTemp;
}

}

i need to replace height so that i can call it using the code
	double htIncrement=100,d;
for(int i=1;1<100;i++)
{
d=planeSimulation::airDensity(i*htIncrement);
}

### #3Reedbeta

DevMaster Staff

• 5308 posts
• LocationSanta Clara, CA

Posted 18 March 2010 - 08:49 PM

First, please use [code]...[/code] to post code on the forum. And when you have two very similar questions it's ok to post them in the same thread (or just post one of them at a time...)

Second, I don't know what error C2660 is off the top of my head...I could look it up but why don't you go ahead and post the whole error message and also annotate the code to show which line the error is on.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #4Nerd_Skywalker

Valued Member

• Members
• 215 posts

Posted 18 March 2010 - 09:00 PM

One thing I notice right away is that you call:
d=planeSimulation::airDensity(i*htIncrement); //Calls function with argument


but the constructor has no argument:
double planeSimulation::airDensity() //No Argument
{
//...
}


TheNut said:

"Hmm, yes. Strong is the force with this one"

### #5benji

New Member

• Members
• 5 posts

Posted 18 March 2010 - 09:09 PM

yeah sorry guys
air_density_test.cpp(9) : error C2660: 'planeSimulation::airDensity' : function does not take 1 arguments
thats the error im getting

and i realise the problem is that im not asking for an argument so i need to work out what i need to write in place of height so that i am asking for a double
pressure=(planeSimulation::seaLevelAirPressure*exp(-(0.0342*(height)/planeSimulation::seaLevelTemp)));
is it possible or am i going to need to rewrite the equation

### #6Nerd_Skywalker

Valued Member

• Members
• 215 posts

Posted 18 March 2010 - 09:19 PM

Oh, I just figured out your problem...

You just need to add a parameter to airPressure() named height to make it airPressure(double height).

That's it. Be glad that I'm nice and helped, some people here would've made you figure out on your own ;)

Also, I have 2 questions of my own:
1)How long have you been programming?
2)What are you making?

TheNut said:

"Hmm, yes. Strong is the force with this one"

### #7benji

New Member

• Members
• 5 posts

Posted 18 March 2010 - 09:24 PM

I have been "programming" for about 18 months however i would say i have only been doing real programming for about 3 months
and i am building parts into a flight simulation for a piece of coursework

### #8Nerd_Skywalker

Valued Member

• Members
• 215 posts

Posted 18 March 2010 - 09:26 PM

Ah, I asked because this is pretty basic stuff (parameters 'n stuff) and this seemed like a advanced project so...

Anyways, did it work?

TheNut said:

"Hmm, yes. Strong is the force with this one"

### #9benji

New Member

• Members
• 5 posts

Posted 18 March 2010 - 09:31 PM

yeah i know its a simple error i get parameters and stuff i've just never put them inside of anything else

and not really sure because its in a different cpp file just kinda trying to work it all out

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users