I'm trying to utilise pointers so I can get using them more.
so far this is how I've laid my code out.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int * p;
int amountOfNumbers = 0;
p = new int [11];
cout << "Please enter the amount of numbers you would like" << endl;
cin >> amountOfNumbers;
for(int i = 0; i < amountOfNumbers; i++)
{
p[0] = 0;
p[1] = 7;
for(int n = 3; n < 11; n++)
{
p[n] = rand() % 9;
}
}
system("pause");
return 0;
}
It's not really finished. Basically what I want it to do is, ask the user how many numbers they want, then a for loop to randomly generate a number between 0 - 9 and assign it to the next array and so fourth. Obviously making sure that each number starts off with 07. Can any one help or suggest a better way of going about it.

New Topic/Question
Reply




MultiQuote






|