style: format code

This commit is contained in:
yanglbme
2019-08-21 10:10:08 +08:00
parent abc0d365de
commit 69ddc9fc52
101 changed files with 3154 additions and 2984 deletions

View File

@@ -1,30 +1,38 @@
#include<iostream>
#include <iostream>
using namespace std;
int main(){
int n,k;
cout<<"Enter size of array=\t";
cin>>n;
cout<<"Enter Number of indeces u want to rotate the array to left=\t";
cin>>k;
int main()
{
int n, k;
cout << "Enter size of array=\t";
cin >> n;
cout << "Enter Number of indeces u want to rotate the array to left=\t";
cin >> k;
int a[n];
cout<<"Enter elements of array=\t";
for(int i=0;i<n;i++){
cin>>a[i];
cout << "Enter elements of array=\t";
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
int temp=0;
for(int i=0;i<k;i++){
temp=a[0];
for(int j=0;j<n;j++){
if(j==n-1){
a[n-1]=temp;
int temp = 0;
for (int i = 0; i < k; i++)
{
temp = a[0];
for (int j = 0; j < n; j++)
{
if (j == n - 1)
{
a[n - 1] = temp;
}
else{
a[j]=a[j+1];
else
{
a[j] = a[j + 1];
}
}
}cout<<"Your rotated array is=\t";
for(int j=0;j<n;j++){
cout<<a[j]<<" ";
}
cout << "Your rotated array is=\t";
for (int j = 0; j < n; j++)
{
cout << a[j] << " ";
}
getchar();
return 0;