I have this problem. I don't know how to prompt user to input for the size of array in a class
#include <iostream>
using namespace std;
class ArrayClass1
{
private:
int *array , size ;
public:
void prompt(void) ; // asks for size of desired array
// and allocates it, then fills it
// with random numbers
void print(void) ; // prints out the array
// Uses sprintf() formatting to keep all
// the numbers nicely aligned vertically.
void createFile( char * filename) ; // opens disk file and writes array to it
void sortArray(void) ; // sorts array using simple Bubble Sort.
} ;
int main ()
{
int array1; // first array to add
std::cout << "Enter the size of array: "; // prompt user for data
std::cin >> array1; // read first integer from user into array1
return 0;// indicate that program ended successfully
} // end function main
My friend recommend me this but how exactly I can put this just to prompt user to input the size...???
cout << "size of array is " << myArray.getSize() << " and the subscript is now " << myArray.getSubscript() << endl;