Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jürgen Hein
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
013b884b
authored
Oct 16, 2024
by
Jürgen Hein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Kodutoo2MassiividLiitmine.c
parent
24029f46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
Kodutöö 2/Kodutoo2MassiividLiitmine.c
Kodutöö 2/Kodutoo2MassiividLiitmine.c
View file @
013b884b
/* Ko
dutöö 2. Variant 4.
/* Ko
dutöö 2. Variant 4.
...
@@ -21,10 +21,10 @@ void CVäljastus(int, int, double[][10]);
...
@@ -21,10 +21,10 @@ void CVäljastus(int, int, double[][10]);
int
main
(
void
)
int
main
(
void
)
{
{
int
n
=
SisestusN
();
int
n
=
SisestusN
();
//read
int
m
=
SisestusM
();
int
m
=
SisestusM
();
//veerud
int
l
=
SisestusL
();
int
k
=
SisestusK
();
//read
int
k
=
SisestusK
();
int
l
=
SisestusL
();
//veerud
double
A
[
n
][
m
];
double
A
[
n
][
m
];
double
B
[
k
][
l
];
double
B
[
k
][
l
];
int
CRida
=
SisestusCRida
(
n
,
k
);
int
CRida
=
SisestusCRida
(
n
,
k
);
...
@@ -44,7 +44,7 @@ int SisestusN()
...
@@ -44,7 +44,7 @@ int SisestusN()
int
n
;
int
n
;
do
do
{
{
printf
(
"Sisestage A
veergu
de arv
\n
"
);
printf
(
"Sisestage A
rida
de arv
\n
"
);
scanf
(
"%d"
,
&
n
);
scanf
(
"%d"
,
&
n
);
if
(
n
<=
1
||
n
>=
10
)
if
(
n
<=
1
||
n
>=
10
)
{
{
...
@@ -59,7 +59,7 @@ int SisestusM()
...
@@ -59,7 +59,7 @@ int SisestusM()
int
m
;
int
m
;
do
do
{
{
printf
(
"Sisestage A
rida
de arv
\n
"
);
printf
(
"Sisestage A
veergu
de arv
\n
"
);
scanf
(
"%d"
,
&
m
);
scanf
(
"%d"
,
&
m
);
if
(
m
<=
1
||
m
>=
10
)
if
(
m
<=
1
||
m
>=
10
)
{
{
...
@@ -69,38 +69,38 @@ int SisestusM()
...
@@ -69,38 +69,38 @@ int SisestusM()
return
m
;
return
m
;
}
}
int
Sisestus
L
()
int
Sisestus
K
()
{
{
int
l
;
int
k
;
do
do
{
{
printf
(
"Sisestage B
veergu
de arv
\n
"
);
printf
(
"Sisestage B
rida
de arv
\n
"
);
scanf
(
"%d"
,
&
l
);
scanf
(
"%d"
,
&
k
);
if
(
l
<=
1
||
l
>=
10
)
if
(
k
<=
1
||
k
>=
10
)
{
{
printf
(
"Sisestatud väärtus ei sobi, sisestage täisarv vahemikus 1...10."
);
printf
(
"Sisestatud väärtus ei sobi, sisestage täisarv vahemikus 1...10."
);
}
}
}
while
(
l
<=
1
||
l
>=
10
);
}
while
(
k
<=
1
||
k
>=
10
);
return
l
;
return
k
;
}
}
int
Sisestus
K
()
int
Sisestus
L
()
{
{
int
k
;
int
l
;
do
do
{
{
printf
(
"Sisestage B
rida
de arv
\n
"
);
printf
(
"Sisestage B
veergu
de arv
\n
"
);
scanf
(
"%d"
,
&
k
);
scanf
(
"%d"
,
&
l
);
if
(
k
<=
1
||
k
>=
10
)
if
(
l
<=
1
||
l
>=
10
)
{
{
printf
(
"Sisestatud väärtus ei sobi, sisestage täisarv vahemikus 1...10."
);
printf
(
"Sisestatud väärtus ei sobi, sisestage täisarv vahemikus 1...10."
);
}
}
}
while
(
k
<=
1
||
k
>=
10
);
}
while
(
l
<=
1
||
l
>=
10
);
return
k
;
return
l
;
}
}
int
SisestusCRida
(
int
n
,
int
k
)
int
SisestusCRida
(
int
n
,
int
k
)
//miinimum ridade arvu leidmine
{
{
int
CRida
;
int
CRida
;
if
(
n
<
k
)
if
(
n
<
k
)
...
@@ -112,7 +112,7 @@ int SisestusCRida(int n, int k)
...
@@ -112,7 +112,7 @@ int SisestusCRida(int n, int k)
}
}
return
CRida
;
return
CRida
;
}
}
int
SisestusCVeerg
(
int
m
,
int
l
)
int
SisestusCVeerg
(
int
m
,
int
l
)
//miinimum veergude arvu leidmine
{
{
int
CVeerg
;
int
CVeerg
;
if
(
m
<
l
)
if
(
m
<
l
)
...
@@ -128,9 +128,9 @@ int SisestusCVeerg(int m, int l)
...
@@ -128,9 +128,9 @@ int SisestusCVeerg(int m, int l)
void
MaatriksSisestus
(
int
n
,
int
m
,
int
k
,
int
l
,
double
A
[][
m
],
double
B
[][
l
])
void
MaatriksSisestus
(
int
n
,
int
m
,
int
k
,
int
l
,
double
A
[][
m
],
double
B
[][
l
])
{
{
int
i
,
j
,
Kontroll
;
//järjenumbrid, scanf kontrolli muutuja
int
i
,
j
,
Kontroll
;
//järjenumbrid, scanf kontrolli muutuja
for
(
i
=
0
;
i
<
m
;
i
++
)
for
(
i
=
0
;
i
<
m
;
i
++
)
//veergude tsükkel
{
{
for
(
j
=
0
;
j
<
n
;
j
++
)
for
(
j
=
0
;
j
<
n
;
j
++
)
//ridade tsükkel
{
{
do
do
{
{
...
@@ -144,9 +144,9 @@ void MaatriksSisestus(int n, int m, int k, int l, double A[][m], double B[][l])
...
@@ -144,9 +144,9 @@ void MaatriksSisestus(int n, int m, int k, int l, double A[][m], double B[][l])
}
while
(
Kontroll
==
0
);
//reaalarvu kontroll
}
while
(
Kontroll
==
0
);
//reaalarvu kontroll
}
}
}
}
for
(
i
=
0
;
i
<
k
;
i
++
)
for
(
i
=
0
;
i
<
l
;
i
++
)
//veergude tsükkel
{
{
for
(
j
=
0
;
j
<
l
;
j
++
)
for
(
j
=
0
;
j
<
k
;
j
++
)
//ridade tsükkel
{
{
do
do
{
{
...
@@ -188,7 +188,7 @@ void VäljastusAlgne(int n, int m, int k, int l, double A[][m], double B[][l])
...
@@ -188,7 +188,7 @@ void VäljastusAlgne(int n, int m, int k, int l, double A[][m], double B[][l])
void
MaatriksLiitmine
(
int
CRida
,
int
CVeerg
,
double
A
[][
CVeerg
],
double
B
[][
CVeerg
],
double
C
[][
CVeerg
])
void
MaatriksLiitmine
(
int
CRida
,
int
CVeerg
,
double
A
[][
CVeerg
],
double
B
[][
CVeerg
],
double
C
[][
CVeerg
])
{
{
int
j
,
i
;
int
j
,
i
;
for
(
i
=
0
;
i
<
CVeerg
;
i
++
)
for
(
i
=
0
;
i
<
CVeerg
;
i
++
)
{
{
for
(
j
=
0
;
j
<
CRida
;
j
++
)
for
(
j
=
0
;
j
<
CRida
;
j
++
)
...
...
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