>>oh and i forgot to say "thank you" for the help -_-
Err, hope that wasn't sarcasm...
I think you've got your 'class' understanding wrong. Declaring a 'class' is sort of like creating a new type, except it's not really. I think this is what you meant to do:
Code:
#include <iostream> //No .h, because .h is the old version
#include <conio.h>
using namespace std; //To accomodate change to #include
class storenumber
{
private: //Doesn't change anything; just makes code clearer
int numbers[6];
public:
//Constructor
storenumber(int, int);
//Member functions
void enter_number(int, int);
int return_number(int c) {return numbers[c];}
};
//Constructor: stores a at the index of b in numbers
//You don't really need this, actually.
storenumber::storenumber (int a, int b)
{
numbers[ b] = a;
}
//Does the same as constructor, but can be called more than once
//to modify the data in the existing 'storenumber' object
void storenumber::enter_number(int a, int b)
{
numbers[ b] = a;
}
int main()
{
//Declare a variable of type 'storenumber', initialize with 0,0
storenumber storednumber(0, 0);
//so now storednumber.numbers[0] is 0
int n, number;
//Input the numbers
cout << "Enter 6 numbers \n";
for (n = 0; n < 6; n++)
{
cin >> number;
storednumber.enter_number(number, n);
}
//Display the numbers
for (n = 0; n < 6; n++)
cout << storednumber.return_number(n);
getch(); //Pause so user can read output
return 0;
}
As a side note, it makes code easier to read when you indent code properly. I re-indented the code, and this is just my personal preference of how to indent, but I suggest that you get into the habit of indenting code in a regular systematic way.
Hope this helps, if you need any more info just ask!