Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gruppe44-PROG1003-2022
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Blakli
Gruppe44-PROG1003-2022
Commits
cd71a50c
Commit
cd71a50c
authored
3 years ago
by
Andreas Blakli
Browse files
Options
Downloads
Patches
Plain Diff
La til:
skirvKlokkeslett() funk. lesTall() funk. i hjelpefunksjoner.cpp og hjelpefunksjoner.h.
parent
c350d037
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
hjelpeFunksjoner.cpp
+32
-1
32 additions, 1 deletion
hjelpeFunksjoner.cpp
hjelpeFunksjoner.h
+4
-0
4 additions, 0 deletions
hjelpeFunksjoner.h
with
36 additions
and
1 deletion
hjelpeFunksjoner.cpp
+
32
−
1
View file @
cd71a50c
...
...
@@ -87,3 +87,34 @@ vector<string> HjelpeFunksjoner::splittStreng(const char& splittPa, const string
split
.
push_back
(
tmp
);
return
split
;
}
void
HjelpeFunksjoner
::
skrivKlokkeslett
(
const
int
&
time
,
const
int
&
min
)
{
if
(
time
<=
9
)
cout
<<
"0"
<<
time
;
else
cout
<<
time
;
cout
<<
":"
;
if
(
min
<=
9
)
cout
<<
"0"
<<
min
;
else
cout
<<
min
;
}
// Basert på Frodes lesInt() funk fra lesData3.cpp
int
HjelpeFunksjoner
::
lesTall
()
{
char
buffer
[
MAX_CHAR
]
=
""
;
int
tall
=
0
;
bool
feil
=
false
;
do
{
feil
=
false
;
cin
.
getline
(
buffer
,
MAX_CHAR
);
tall
=
atoi
(
buffer
);
if
(
tall
==
0
&&
buffer
[
0
]
!=
'0'
)
{
feil
=
true
;
std
::
cout
<<
"
\n
Error: Ikke et tall!"
<<
'\n'
;
}
}
while
(
feil
);
return
tall
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
hjelpeFunksjoner.h
+
4
−
0
View file @
cd71a50c
...
...
@@ -7,6 +7,8 @@
#include
<regex>
#include
<string>
#include
"konstanter.h"
class
HjelpeFunksjoner
{
public:
std
::
string
rensStreng
(
std
::
string
str
);
...
...
@@ -14,6 +16,8 @@ class HjelpeFunksjoner {
bool
erBokstav
(
std
::
string
str
);
std
::
string
gjorOmTilStorBokstav
(
const
std
::
string
&
str
);
std
::
vector
<
std
::
string
>
splittStreng
(
const
char
&
splittPa
,
const
std
::
string
&
str
);
void
skrivKlokkeslett
(
const
int
&
time
,
const
int
&
min
);
int
lesTall
();
};
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment