im new to c++....... was trying something out using "class", and my program doesnt work proerpely............

Code:#include <iostream.h> #include <conio.h> class storenumber { int numbers[6]; public: storenumber(int, int); int return_number(int c) {return numbers[c];} }; storenumber::storenumber (int a, int b) { numbers[b] = a; } int main() { storenumber storednumber(0, 0); int n, number; cout << "Enter 6 numbers \n"; for (n = 0; n < 6; n++) { cin >> number; storenumber storednumber (number, n); } for (n = 0; n < 6; n++) cout << storednumber.return_number(n); getch(); return 0; }

the program accepts 6 numbers from the user and then store it in "class" until its called out. the program does run but gives out an unexpected result.

Code tags added by kermi3Code:a