Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PPC2025_CT11
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kazuyuki Omi
PPC2025_CT11
Commits
bfd14708
Commit
bfd14708
authored
1 week ago
by
Kazuyuki Omi
Browse files
Options
Downloads
Patches
Plain Diff
change in name
parent
04dba287
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hw/hw01/get_config
+0
-0
0 additions, 0 deletions
hw/hw01/get_config
hw/hw01/get_config.cpp
+5
-3
5 additions, 3 deletions
hw/hw01/get_config.cpp
hw/hw01/get_numbers.cpp
+65
-0
65 additions, 0 deletions
hw/hw01/get_numbers.cpp
with
70 additions
and
3 deletions
hw/hw01/get_config
0 → 100755
+
0
−
0
View file @
bfd14708
File added
This diff is collapsed.
Click to expand it.
hw/hw01/
sstream2
.cpp
→
hw/hw01/
get_config
.cpp
+
5
−
3
View file @
bfd14708
...
...
@@ -48,7 +48,7 @@ void get_config(setting &a)
}
}
/*
void get_numbers(setting &a)
{
std::string line;
...
...
@@ -74,20 +74,22 @@ void get_numbers(setting &a)
}
}
*/
int
main
()
{
setting
a
;
get_config
(
a
);
get_numbers
(
a
);
//
get_numbers(a);
std
::
cout
<<
a
.
min
<<
" "
<<
a
.
max
<<
" "
<<
a
.
width
<<
" "
<<
a
.
align
<<
std
::
endl
;
/*
for(int num: a.numbers)
{
std::cout<<num<<" ";
}
std
::
cout
<<
std
::
endl
;
*/
return
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
hw/hw01/get_numbers.cpp
0 → 100644
+
65
−
0
View file @
bfd14708
#include
<iostream>
#include
<sstream>
#include
<string>
#include
<vector>
#include
<cstring>
void
sum
(
std
::
vector
<
int
>&
numbers
,
std
::
string
&
range
)
{
int
suma
=
0
;
std
::
cout
<<
range
<<
std
::
endl
;
for
(
int
num
:
numbers
)
{
suma
+=
num
;
}
std
::
cout
<<
suma
<<
std
::
endl
;
}
int
main
()
{
std
::
vector
<
int
>
numbers
;
int
max
=
50
;
int
min
=
-
50
;
std
::
string
line
;
std
::
cout
<<
"zadejte cisla: "
;
std
::
getline
(
std
::
cin
,
line
);
std
::
istringstream
iss
(
line
);
//元の文字列を分割して、解析するための変数
std
::
string
token
;
//
std
::
string
range
;
int
tmp
=
0
;
//指定した区切り文字、今回は;までをtokenに保存、デフォルトは\n改行。
while
(
std
::
getline
(
iss
,
token
,
';'
))
{
if
(
token
==
"SUM"
)
{
range
=
token
;
sum
(
numbers
,
range
);
}
else
{
tmp
=
std
::
stoi
(
token
);
if
(
tmp
>
max
||
tmp
<
min
)
{
std
::
cout
<<
"Out of range"
<<
std
::
endl
;
return
2
;
}
numbers
.
push_back
(
tmp
);
}
}
for
(
int
num
:
numbers
)
{
std
::
cout
<<
num
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
return
0
;
}
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