-
Notifications
You must be signed in to change notification settings - Fork 1
/
spreadsheets.cpp
52 lines (50 loc) · 918 Bytes
/
spreadsheets.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "bits/stdc++.h"
#define MP make_pair
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
using namespace std;
using ll = long long;
using uint = unsigned int;
using pii = pair<int, int>;
using vi = vector <int>;
int n;
char alph[26];
void char_gen()
{
char c='A';
for (int i = 0; i < 26; i++)
{
alph[i]=c+i;
}
}
int main()
{
char_gen(); //generate the alphabets
cin>>n;
string names[n][n]; //declaring a n*n array of names
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
int size = max(((int)(rand()*1000)%10),5);
string s="";
while(size--)
{
int indx = (int)(rand()*1000)%26; //generate a word
s+=alph[indx];
}
names[i][j]=s; //push it in the array
}
}
int count=n;
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count; j++)
{
cout<<names[i][j]<<" ";
}
cout<<endl;
}
return 0;
}