Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4a62b4de
authored
Jul 16, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
7d7efad3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
49 deletions
test/test4.go
test/test4.go
View file @
4a62b4de
package
main
package
main
\ No newline at end of file
import
(
<<<<<<<
HEAD
"bytes"
"fmt"
)
func
intsToString
(
values
[]
int
)
string
{
var
buf
bytes
.
Buffer
buf
.
WriteByte
(
'['
)
for
i
,
v
:=
range
values
{
if
i
>
0
{
buf
.
WriteString
(
", "
)
}
fmt
.
Fprintf
(
&
buf
,
"%d"
,
v
)
}
buf
.
WriteByte
(
']'
)
return
buf
.
String
()
}
func
main
()
{
fmt
.
Println
(
intsToString
([]
int
{
1
,
2
,
3
}))
// "[1, 2, 3]"
=======
"fmt"
"strconv"
)
func
main
()
{
var
a
,
b
,
c
float64
a
=
1.69
*
100
b
=
1.7
*
10
c
=
a
*
b
/
(
100
*
10
)
//ȷ2.873
fmt
.
Println
(
c
)
//fmt.Println(fmt.Sprintf("%.2f",c))
//fmt.Println(FloatRound(c,2))
}
// ȡСλ
func
FloatRound
(
f
float64
,
n
int
)
float64
{
format
:=
"%."
+
strconv
.
Itoa
(
n
)
+
"f"
//fmt.Println(format)
res
,
_
:=
strconv
.
ParseFloat
(
fmt
.
Sprintf
(
format
,
f
),
64
)
return
res
>>>>>>>
326
ae7ed67d5d2db331dddd1277d36b8b1992b08
}
\ No newline at end of file
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