Explanation :
1d Array is Also
called as One Dimensional Array , Which Means Array or a Matrix with only
Single Row .
In the below given
Program we had created 1 dimensional array or the 1d array without taking the
user’s Input .
Algrothim :
Follow the steps to Create the 1d Array without taking user’s input
Step 1 : Initialize the counter ( i.e. i = 0
) and Array with Element size and
value
Step 2 : Display the Statement
Step 3 :
Start the for [ LOOP ] from 0 till 10 …
Step 4 :
Display the Element of Array at
given index from i
Step 5 : Increment the Counter ( i ) with 1
Step 6 : [ END LOOP ]
Step 7 : Stop
Code :
Output :
Executable Code :
#include<iostream> //
Declaring the standard Input and Output
using namespace std;
// Creating the Main where the
execution will Take Place and will resturn Something
int main()
{
int
i; // creating a Counter
int
arr[20]= {1,2,3,4,5,6,7,8,9,1}; // creating the array of 10 elements
//
creating the loop for printing the values
cout<<"
1D Array \n\n"; // displaying 1D Array
for(i=0;i<10;i++)
{
cout<<arr[i]<<"\t"; // Printing The Array using gor loop
}
return
0;
}