#include <iostream>
using namespace std;
int main()
{
//--- Declare array and number of elements in it.
float a[10];
int n; // Number of values currenlty in array.
{
//--- Read numbers into an array
for (i = 0; i < 10; i++)
cout << "Enter a number: " << cin << a[n];
}
//--- Print array in reverse order
for (int i=n-1; i>=0; i--)
{
cout << a[i] << endl;
}
return 0;
}
----------------------------------------------------------------------------------
#include<iostream.h>
#include<conio.h>
#define MAX 10 /* Declare as Macro */
void main(void)
{
float a[10];
int i;
clrscr(); /* To clear the Screen */
for(i=0;i<MAX;i++)
{
cout <<"\n Enter"<<i+1<<" Number ";
cin >>a[i];
}
//DISPLAY THE ARRAY IN REVERSE ORDER
for(i=MAX;i>=0;i--)
{
cout <<"\n"<<a[i]<<"\n";
}
getch();
}
using namespace std;
int main()
{
//--- Declare array and number of elements in it.
float a[10];
int n; // Number of values currenlty in array.
{
//--- Read numbers into an array
for (i = 0; i < 10; i++)
cout << "Enter a number: " << cin << a[n];
}
//--- Print array in reverse order
for (int i=n-1; i>=0; i--)
{
cout << a[i] << endl;
}
return 0;
}
----------------------------------------------------------------------------------
#include<iostream.h>
#include<conio.h>
#define MAX 10 /* Declare as Macro */
void main(void)
{
float a[10];
int i;
clrscr(); /* To clear the Screen */
for(i=0;i<MAX;i++)
{
cout <<"\n Enter"<<i+1<<" Number ";
cin >>a[i];
}
//DISPLAY THE ARRAY IN REVERSE ORDER
for(i=MAX;i>=0;i--)
{
cout <<"\n"<<a[i]<<"\n";
}
getch();
}
0 comments:
Post a Comment