We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a4c2d43 commit 8e5d583Copy full SHA for 8e5d583
C++/Data-Structures/ARRAYS/.gitignore
@@ -0,0 +1,5 @@
1
+# IGNORE FILES FOR C++
2
+
3
+*.o
4
+*.out
5
+*.exe
C++/Data-Structures/ARRAYS/1darrays.cpp
@@ -0,0 +1,29 @@
+/*
+ * 1 Dimensional Array
+ */
+#include <iostream>
+using namespace std;
6
+int main()
7
+{
8
+ int n; //size of the array
9
+ cout << "Enter the size of the array" << endl;
10
+ cin >> n;
11
+ int arr[n]; //decalared 1d array of size n
12
+ cout << "Enter the elements of the array" << endl;
13
+ for(int i=0;i<n;i++)
14
+ {
15
+ cin >> arr[i];
16
+ }
17
+ cout << "Entered array:" <<endl;
18
19
20
+ if(i==n-1)
21
22
+ cout << arr[i] << endl;
23
24
+ else
25
26
+ cout << arr[i]<<" ";
27
28
29
+}
0 commit comments