Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alxm2023
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
alxm2023
Commits
b0c0a119
Commit
b0c0a119
authored
Dec 21, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zajęcia 14 grudnia
parent
7978c885
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
0 deletions
+96
-0
fibonacci.cpp
20231214/fibonacci.cpp
+23
-0
funkcje_na_tablicach.cpp
20231214/funkcje_na_tablicach.cpp
+35
-0
zamazanie_danych.cpp
20231214/zamazanie_danych.cpp
+38
-0
No files found.
20231214/fibonacci.cpp
0 → 100644
View file @
b0c0a119
#include <iostream>
using
namespace
std
;
int
main
()
{
int
ile
;
cout
<<
"Ile liczb Fibonacciego mam wypisac? "
;
cin
>>
ile
;
unsigned
long
long
teraz
=
0
,
poprzednia
=
1
,
nastepna
=
0
;
for
(
int
i
=
0
;
i
<=
ile
;
i
++
)
{
cout
<<
teraz
<<
" "
;
nastepna
=
teraz
+
poprzednia
;
poprzednia
=
teraz
;
teraz
=
nastepna
;
}
cout
<<
endl
;
return
0
;
}
// ciąg Fibonacciego:
// na początku mamy 0 i 1
// każda kolejna liczba jest sumą dwóch poprzednich
// 0 1 1 2 3 5 8 13 21 34 55 ...
20231214/funkcje_na_tablicach.cpp
0 → 100644
View file @
b0c0a119
#include <iostream>
using
namespace
std
;
void
wypisz
(
int
t
[],
int
rozmiar
)
{
for
(
int
i
=
0
;
i
<
rozmiar
;
i
++
)
{
cout
<<
t
[
i
]
<<
" "
;
}
cout
<<
endl
;
}
// napisz funkcję typu int, która oblicza sumę liczb z przekazanej tablicy
int
suma
(
int
t
[],
int
rozmiar
)
{
int
suma
=
0
;
for
(
int
i
=
0
;
i
<
rozmiar
;
i
++
)
{
suma
+=
t
[
i
];
}
return
suma
;
}
int
main
()
{
int
zera
[
10
]
=
{
0
};
int
a
[
10
]
=
{
13
,
6
,
1
,
10
,
15
,
3
,
9
,
7
,
10
,
4
};
int
b
[
3
]
=
{
11
,
22
,
33
};
int
c
[
5
]
=
{
1000
,
2000
,
3000
,
4000
,
5000
};
wypisz
(
zera
,
10
);
wypisz
(
a
,
10
);
wypisz
(
b
,
3
);
wypisz
(
c
,
5
);
cout
<<
"Sumy:"
<<
endl
;
cout
<<
suma
(
a
,
10
)
<<
endl
;
cout
<<
suma
(
b
,
3
)
<<
endl
;
cout
<<
suma
(
c
,
5
)
<<
endl
;
return
0
;
}
20231214/zamazanie_danych.cpp
0 → 100644
View file @
b0c0a119
#include <iostream>
using
namespace
std
;
void
wypisz
(
int
t
[],
int
rozmiar
)
{
for
(
int
i
=
0
;
i
<
rozmiar
;
i
++
)
{
cout
<<
t
[
i
]
<<
" "
;
}
cout
<<
endl
;
}
void
wypelnij
(
int
element
,
int
t
[],
int
rozmiar
)
{
for
(
int
i
=
0
;
i
<
rozmiar
;
i
++
)
{
t
[
i
]
=
element
;
}
}
int
main
()
{
int
a
[
6
];
int
b
[
6
];
int
c
[
6
];
wypelnij
(
1
,
a
,
6
);
wypelnij
(
2
,
b
,
6
);
wypelnij
(
3
,
c
,
6
);
cout
<<
"Tablice wypełnione poprawnie:
\n
"
;
wypisz
(
a
,
6
);
wypisz
(
b
,
6
);
wypisz
(
c
,
6
);
// celowo podaję większy rozmiar, niż 5
wypelnij
(
7
,
b
,
10
);
cout
<<
"Tablice wypełnione niepoprawnie:
\n
"
;
wypisz
(
a
,
6
);
// tablica a też zostala zmieniona
wypisz
(
b
,
6
);
wypisz
(
c
,
6
);
return
0
;
}
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