+ 1
Sorry to ask.How to display random alphabet in table ?? Like 4 random alphabet (without repeat) table with row 2 column 2
The table have border
8 Réponses
+ 4
If I understood your question Shannen then this is the solution:
https://code.sololearn.com/cPz4KPNDlsgj/?ref=app
+ 2
You mean each cell contains exactly one character? i think the tricky part is the border printing part ...
+ 2
Yes
+ 2
Thanks ☺️
+ 1
About the 4 random characters, since you'd be using char array ...
Generate random value between 33 ~ 128 (exclusive). Check whether such value exist in the char array by using strchr() fromX:Ft <cstring>. If such character already exiat, generate another one until all 4 slots are filled with unique values.
Can't suggest anything on the border printing part though ...
+ 1
Start with "abcd";
For i from 5 to 25
geneate a random number from 0 to i
If it's less than 5 substitute that character with the i-th letter in the alphabet
E.g.:
abcd
'e' : rand from 0 to 5 -> 3
abce
'f' : rand from 0 to 6 -> 1
abfe
'g' : rand from 0 to 7 -> 5
abfe
...
'z' : rand from 0 to 25 ->3
jtfz
For printing the grid you could use unicode box drowning characters,
or just plain old ASCII
E.g.:
=== ___ +--- ###
|| a | a | a # a
+ 1
JaScript Function and array is so difficult for me to understand,u help me a lot to solve the problem...Thanks a lot
+ 1
👍 thanks