Sunday, September 15, 2019

C++ Language Program To Traverse Array.

BACHELOR OF COMPUTER APPLICATION (B.C.A.) FIRST SEMESTER

Here you will get simple C++ program 
C++ Language Program To Traverse Array.
IT IS THE SMALLEST LOGIC USED FOR CODING OF THIS PROGRAM.
IN WHICH YOU CAN CREATE OWN VARIABLES AND FUNCTIONS.

User will input will be in any order in Array and that Array is Traverse by Traversing ,then it will be display on screen.


The program coding is given below.
#include<iostream.h>
#include<conio.h>
class Node
{
int i,a[10];
public:
void getdata()
{
cout<<"Enter Number in Array=\n";
for(i=1;i<=5;i++)
{
cin>>a[i];
}
}
void display()
{
cout<<"\nArray\n";
for(i=1;i<=5;i++)
{
cout<<" "<<a[i];
}
}
};
void main()
{
Node n1;
clrscr();
n1.getdata();
n1.display();
getch();
}
Output will be given after you compile it.

No comments:

Post a Comment