-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50606ca
commit f7fadeb
Showing
3 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* @author : dhruv-gupta14 | ||
* @date : 15/01/2019 | ||
*/ | ||
|
||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() { | ||
int n,m; | ||
cin >> n >> m; | ||
int arr1[n]; | ||
int arr2[m]; | ||
|
||
for(int i=0;i<n;i++) | ||
cin >> arr1[i]; | ||
|
||
for(int j=0;j<m;j++) | ||
cin >> arr2[j]; | ||
|
||
for(int l=0;l<n;l++) | ||
{ | ||
for(int k=0;k<m;k++) | ||
{ | ||
cout << arr1[l] << "," << arr2[k] << endl; | ||
} | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* @author : dhruv-gupta14 | ||
* @date : 15/01/2019 | ||
*/ | ||
|
||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
int arr1[n]; | ||
|
||
for(int i=0;i<n;i++) | ||
cin >> arr1[i]; | ||
|
||
int temp=0; | ||
int random_index = 0; | ||
|
||
for(int j=0;j<n;j++) | ||
{ | ||
random_index = rand() % n; | ||
temp = arr1[j]; | ||
arr1[j] = arr1[random_index]; | ||
arr1[random_index] = temp; | ||
} | ||
|
||
for(int k=0;k<n;k++) | ||
cout << arr1[k] << " "; | ||
|
||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters