Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ferhat tamer
ex1
Commits
3c4b2329
Commit
3c4b2329
authored
Feb 23, 2022
by
ferhat tamer
💬
Browse files
Update ex2.go
parent
55ea4a1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
ex2.go
View file @
3c4b2329
...
...
@@ -5,21 +5,21 @@ import (
"time"
)
func
main
()
{
const
oyuncusayisi
,
satirsayisi
,
sutunsayisi
=
2
,
3
,
5
s1
:=
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
())
r1
:=
rand
.
New
(
s1
)
var
tombala
[
2
][
3
][
5
]
int
for
x
:=
0
;
x
<
oyuncusayisi
;
x
++
{
fmt
.
Println
(
x
+
1
,
"numarali oyuncu"
)
for
y
:=
0
;
y
<
satirsayisi
;
y
++
{
for
z
:=
0
;
z
<
sutunsayisi
;
z
++
{
tombala
[
x
][
y
][
z
]
=
(
r1
.
Intn
(
100
))
const
oyuncusayisi
,
satirsayisi
,
sutunsayisi
=
2
,
3
,
5
//oyuncu sayısı , satır sayısı ve sütun sayısını değişkenlerine değer atıyoruz.
s1
:=
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
())
//tohum atıyoruz.
r1
:=
rand
.
New
(
s1
)
//attığımız tohumdan random sayı üretip r1 değişkenine atıyoruz.
var
tombala
[
2
][
3
][
5
]
int
//tombala adında matris olusturma 2 oyunculu 3 satır 5 sütunlu bir kagıt olustuuyoruz.
for
x
:=
0
;
x
<
oyuncusayisi
;
x
++
{
//oyuncu sayısı kadar dönen döngü.
fmt
.
Println
(
x
+
1
,
"numarali oyuncu"
)
//döngüden gelen oyuncu sayisina 1 ekliyoruz ekrana basıyoruz. sayma sayıları 1'den başladığı için 0. oyuncu olamaz.
for
y
:=
0
;
y
<
satirsayisi
;
y
++
{
//satir sayisi kadar dönen döngü.
for
z
:=
0
;
z
<
sutunsayisi
;
z
++
{
//sutunsayisi kadar dönen döngü.
tombala
[
x
][
y
][
z
]
=
(
r1
.
Intn
(
100
))
//1 ile 100 arasında random sayı üretip bu sayıyı matrisimizin içine dolduruyoruz.
//fmt.Print("satır degeri :",y)
//fmt.Print("sutun degeri :",z)
fmt
.
Print
(
" |"
,
tombala
[
x
][
y
][
z
],
" |"
)
fmt
.
Print
(
" |"
,
tombala
[
x
][
y
][
z
],
" |"
)
//x,y,z değerlerine karşılık gelen matris içerisindeki değeri ekrana yazdırır.
}
fmt
.
Println
(
"
\n
"
)
fmt
.
Println
(
"
\n
"
)
//oyuncu sırasını ekrana bastıktan sonra alt satıra geçiyoruz.
}
fmt
.
Println
(
"
\n
"
)
fmt
.
Println
(
"
\n
"
)
//satırları ekrana bastıktan sonra alt satıra geçiyoruz.
}
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment