Skip to content

Commit

Permalink
Done basics on Character array.
Browse files Browse the repository at this point in the history
  • Loading branch information
bashu22tiwari committed Jan 31, 2021
1 parent 25b4a4f commit 5c7edff
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Character Array/basic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// In this we will be going to learn about the character array

#include <bits/stdc++.h>
using namespace std;

int main()
{
char array[100];
cin >> array ;

cout << array[2] ;

}
Binary file added Character Array/basic.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions Multi-dimensional Arrays/spiral.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// In this we will be printing the array in the spiral order.

#include <bits/stdc++.h>
using namespace std;

int main()
{
int n, m ;
cin >> n >> m ;
int array[n][m] ;
for(int i=0 ; i<n ; i++)
{
for(int j=0; j<m ; j++)
{
cin >> array[i][j] ;
}
}
int rs=0;
int re=n-1;
int cs=0;
int ce=m-1;
while(rs<= re && cs <=ce)
{
for(int i=cs ; i<=ce ; i++)
{
cout << array[rs][i] << " " ;
}
rs++;
for(int i=rs ; i<=re ; i++)
{
cout << array[i][ce] << " " ;
}
ce--;
for(int i=ce ; i>=cs ; i--)
{
cout << array[re][i] << " " ;
}
re--;
for(int i=re ; i>=rs ; i--)
{
cout << array[i][cs] << " " ;
}
cs++;
}


}
Binary file added Multi-dimensional Arrays/spiral.exe
Binary file not shown.

0 comments on commit 5c7edff

Please sign in to comment.