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
04dba287
Commit
04dba287
authored
1 week ago
by
Kazuyuki Omi
Browse files
Options
Downloads
Patches
Plain Diff
Moved sstream2 to hw01
parent
f249b79d
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/sstream2
+0
-0
0 additions, 0 deletions
hw/hw01/sstream2
hw/hw01/sstream2.cpp
+0
-0
0 additions, 0 deletions
hw/hw01/sstream2.cpp
sstream2.cpp
+93
-0
93 additions, 0 deletions
sstream2.cpp
with
93 additions
and
0 deletions
hw/hw01/sstream2
0 → 100755
+
0
−
0
View file @
04dba287
File added
This diff is collapsed.
Click to expand it.
hw/sstream2.cpp
→
hw/
hw01/
sstream2.cpp
+
0
−
0
View file @
04dba287
File moved
This diff is collapsed.
Click to expand it.
sstream2.cpp
0 → 100644
+
93
−
0
View file @
04dba287
#include
<iostream>
#include
<sstream>
#include
<string>
#include
<vector>
typedef
struct
setting
{
int
min
=
0
;
int
max
=
0
;
int
width
=
2
;
std
::
string
align
=
"left"
;
std
::
vector
<
int
>
numbers
;
int
count
=
0
;
int
suma
=
0
;
}
setting
;
void
get_config
(
setting
&
a
)
{
std
::
string
line
;
std
::
cout
<<
"start configration"
<<
std
::
endl
;
std
::
getline
(
std
::
cin
,
line
);
std
::
istringstream
iss
(
line
);
std
::
string
setting
;
//configのそれぞれを見分けるための変数min, max, width, or align.
//issに、tokenの値を入れ、終わるのはeofつまり、何も読み込めない時。
while
(
iss
>>
setting
)
{
std
::
istringstream
setting_stream
(
setting
);
std
::
string
key
;
std
::
getline
(
setting_stream
,
key
,
'='
);
if
(
key
==
"config.min"
)
{
setting_stream
>>
a
.
min
;
}
else
if
(
key
==
"config.max"
)
{
setting_stream
>>
a
.
max
;
}
else
if
(
key
==
"config.width"
)
{
setting_stream
>>
a
.
width
;
}
else
if
(
key
==
"config.align"
)
{
setting_stream
>>
a
.
align
;
}
}
}
void
get_numbers
(
setting
&
a
)
{
std
::
string
line
;
std
::
cout
<<
"zadejte cisla"
<<
std
::
endl
;
std
::
getline
(
std
::
cin
,
line
);
std
::
istringstream
iss
(
line
);
std
::
string
point
;
while
(
iss
>>
point
)
{
if
(
point
==
"SUM(A:C)"
)
{
//sum(a);
break
;
}
std
::
istringstream
num_stream
(
point
);
int
number
;
if
(
num_stream
>>
number
)
{
a
.
numbers
.
push_back
(
number
);
}
}
}
int
main
()
{
setting
a
;
get_config
(
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.
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