Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wektor_cpp
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
wektor_cpp
Commits
010aee55
Commit
010aee55
authored
Apr 28, 2026
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sprawdzanie zakresu get set i wyjątki tekstowe
parent
176a8212
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
program.cpp
program.cpp
+9
-0
wektor.cpp
wektor.cpp
+6
-1
No files found.
program.cpp
View file @
010aee55
...
...
@@ -24,6 +24,15 @@ int main() {
std
::
cout
<<
"size: "
<<
w
.
size
()
<<
'\n'
;
std
::
cout
<<
w
<<
'\n'
;
// EXN w.set(50, 5050);
try
{
w
.
set
(
50
,
5050
);
std
::
cout
<<
"udało się ustawić element 50
\n
"
;
}
catch
(
const
char
*
exn
)
{
std
::
cout
<<
"wyjątek "
<<
exn
<<
'\n'
;
}
std
::
cout
<<
"Koniec programu
\n
"
;
return
0
;
}
wektor.cpp
View file @
010aee55
...
...
@@ -33,11 +33,16 @@ void Wektor::push_back(int e) {
}
void
Wektor
::
set
(
int
idx
,
int
e
)
{
// FIXME kontrola zakresu
if
(
idx
<
0
||
idx
>=
liczba_elementow
)
{
throw
"indeks poza zakresem"
;
}
t
[
idx
]
=
e
;
}
int
Wektor
::
get
(
int
idx
)
{
if
(
idx
<
0
||
idx
>=
liczba_elementow
)
{
throw
"indeks poza zakresem"
;
}
return
t
[
idx
];
}
...
...
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