help with c++

6eb0b7f1624808b97ccc2c099ffef14c
0
benji 101 Mar 18, 2010 at 20:27

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;
        }
            
    
    
}

8 Replies

Please log in or register to post a reply.

6eb0b7f1624808b97ccc2c099ffef14c
0
benji 101 Mar 18, 2010 at 20:29

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);
}
A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Mar 18, 2010 at 20:49

First, please use …[/code[b][/b]] 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. [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.

B2d356f97a3d0dec8ae2d8c1e1fa1c2d
0
Nerd_Skywalker 101 Mar 18, 2010 at 21:00

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
{
    //...
}
6eb0b7f1624808b97ccc2c099ffef14c
0
benji 101 Mar 18, 2010 at 21:09
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

B2d356f97a3d0dec8ae2d8c1e1fa1c2d
0
Nerd_Skywalker 101 Mar 18, 2010 at 21:19

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?

6eb0b7f1624808b97ccc2c099ffef14c
0
benji 101 Mar 18, 2010 at 21:24

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

B2d356f97a3d0dec8ae2d8c1e1fa1c2d
0
Nerd_Skywalker 101 Mar 18, 2010 at 21:26

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

Anyways, did it work?

6eb0b7f1624808b97ccc2c099ffef14c
0
benji 101 Mar 18, 2010 at 21:31

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