[Torbecire]
I want to get the a.cpp to read from the a.h file. But it won't, i have done this class thing before and it worked on another program but won't work on this. Help me out.

// File a.h

#ifndef LINEAR
#define LINEAR

class linear
{
public:
    linear();
    linear(int);
    
    // FUEL CONSUMPTION
    void fuelconsum();
    void fuelconsum(int);
    
    // FUEL FLOW RATE
    void frate();
    void frate(int);
    
    // LANDER MASS
    //void massl();
    void massl(int);
    
    // LANDER THRUST
    //void thrust();
    void thrust(int);
    
    // ADD FUEL, ALTITUDE
    void increment(int);
    
    // REDUCE FUEL, ALTITUDE
    void decrement(int);
    
    // ALTITUDE
    //void alt();
    void alt (int);
    
    // FUEL IN TANK
    void tankf();
    void tankf(int);
    
    // VERTICAL SPEED
    void vspeed();
    void vspeed(int);
    
    int getCount() const;
    
    int getMaxValue() const;
    
private:
    int Count() const;
    int MaxValue() const;
};


// File: a.cpp

#include "a.h"
#include <iostream>
#include <climits>
using namespace std;

int main()
{
    linear::linear()
    {
        Count = 0;
        MaxValue = INT_MAX;
    }
    linear::linear(int mval)
    {
        Count = 0;
        MaxValue = mval;
    }
    // ALTITUDE
    void linear::alt()
    {
        Count = 1000;
        maxalt = mValue;
    }
    // FUEL IN TANK
    void linear::tankf()
    {
        Count = 1700;
        maxtankf = mValue;
    }
    // FUEL CONSUMPTION
    void linear::fuelconsum()
    {
        Count = 10/secs;
        mfuelconsum = mValue;
    }
    // LANDER THRUST
    void linear::thrust()
    {
        Count = 5000;
        mthrust = mValue;
    }
    
    // VERTICAL SPEED
    void linear::vspeed()
    {
        Count = 0/(vdistance/secs);
        (maxvd/secs) = mValue;
    }
    
    // FUEL FLOW RATE
    void linear::frate()
    {
        if(frate > 0 && frate ==0)
        {
            Count =0;
        }
        else
            Count(int);
        maxval = mValue;
    }
    
    // LANDER MASS W/O FUEL
    void linear::massl()
    {
        Count = 900;
        maxmassl = 2600;
    }
    
    //
    void linear::mValue()
    {
        Count = 0;
        mValue = INT_MAX;
    }
    
    int linear::getCount()
    {
        return Count;
    }
    int linear::getMaxValue()
    {
        return MaxValue;
    }
}

I have already warned you before not to use colors to fomat your code and enclose them in code tags. I am fed up of editing your posts. The way you post makes it difficult to read your post. The same thing next time will fetch you an infraction.

And btw, in your header file you haven't declared the member variables Count and mValue , but private member functions Count () and mValue (). Those things are not the same...

You need to declare each and every member variable in the header file before using them -- either as public, private or protected.

I have already warned you before not to use colors to fomat your code and enclose them in code tags. I am fed up of editing your posts. The way you post makes it difficult to read your post. The same thing next time will fetch you an infraction.

And btw, in your header file you haven't declared the member variables Count and mValue , but private member functions Count () and mValue (). Those things are not the same...

You need to declare each and every member variable in the header file before using them -- either as public, private or protected.

Hey if they were instructions any where i would follow them to the final dot. So how do i post. I see people post with all kinds of colors. I do not like to put people under stress so unless someone is willing to tell me how to do it (I will be lost forever).
I don't mind being corrected.

Read this. Just put your code in the code tags, something like this:

#include <iostream>
using namespace std ;

int main ()
{
    // code
}

Then it will look something like this:

#include <iostream>
using namespace std ;

int main ()
{
    // code
}

Also format and indent your code properly, the way I have done.

Edited 3 Years Ago by pritaeas: Fixed formatting

>Hey if they were instructions any where i would follow them to the final dot.
Sorry, but I'm calling you on that. Either you're lying, or you selectively ignore instructions so that you can whine when people correct you. The instructions are watermarked in the text editor. They're pretty hard to miss, as you see them every time you post.

This article has been dead for over six months. Start a new discussion instead.