Can someone help me to output each array element

#include <iostream.h>

void array();

const int LIMIT = 50;
float MYARRAY[LIMIT];
float value = 0;
int x;


void main()
{
	
for(x=0;x<LIMIT;x++)
{
	while(value < 999)
	{ 
		cout << "\n\nPlease enter a number: ";
		cin >> MYARRAY[x];
		value = value + MYARRAY[x];
	}
}
}

Here we go

void main

This is wrong main returns an int so it should be:

int main()
{
   //stuff
   return 0;
}

Second <iostream.h> is a old header its not standard so use this instead

#include <iostream>
using namespace std;//There are other options but this is the "easiest"

Third, you don't really need to use global variables in this case.

Fourth your logic is all off. I'm not sure what your goal is but I think what you want to do is this

#include <iostream>
using namespace std;

const int LIMIT = 50; //this is okay to have global because it's a const

int main()
{
    int myArray[LIMIT];
    int value;
    int i = 0;
    int print = 0;
    bool exit = false;
    
    while(!exit && i < LIMIT)
    {
        cout<<"Enter a number or 999 to quit ";
        cin>>value;
                
        if(value != 999)
        {
            myArray[i] = value;
            i++;
        }
        else
        {
            exit = true;//if value equals 999 exit the loop
        }
        
    }         
    while(print < i)
    {
        cout<<myArray[print]<<endl;//print out the number as long as we are less than i
        print++;
    }
    //"pause" the program
    cin.ignore(80,'\n');
    cin.get();
    return 0;
}

Or to print out each array value:

int i[5]= {1,2,3,4,5};

for (int j = 0 ; j < 5; j++)
cout <<  i[j] << endl;

that will print
1
2
3
4
5

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.