So i am new to c++, I don't know what is wrong with my program, I keep looking for the issue but can't find why it won'r run. So i am trying to develop a program which reads the numbers the user inputs and convert those into rows of asterisks. The limits for height is 5 and for length is 60. If i type -1, then it should exit and show the user how many numbers i input (e.g 1 2 3 4 5 6 3 2 1 = 9 number) and should show the rows of asterisk depending on each number. It keeps telling me to use pointers, i know what pointers are but dont know how to apply them to my program.
#include <iostream>
#include <iomanip>
#include <cmath>
#include <ios>
using namespace std;
int main()
{
const int MAX=60;
int num, count = 0;
count[MAX];
cout << "enter a list of positive numbers, enter -1 to end the list: \n";
do
{
cin>> num;
if (num >= 0)
{
count++;
}
else if ( num == -1)
{
for (int i = 0; i < MAX; i++)
{
cout << " you entered "<< count <<" numbers\n";
cin >> count[i];
}
for(int y=0;y<5;y++)
{
for(int x=0;x<MAX;x++)
{
if (count[x]>=20-y)
cout<<"*";
else cout<<" ";
}
exit (0);
}
}
while (num != 0);
system("pause");
return 0;
}