package main

import "fmt"

func sumAndDiff(x, y int, f float64, s string) (int, int) {
	fmt.Printf("%s\n", s)
	fmt.Printf("测试浮点数: %.3f\n", f)
	return x + y, x - y
}

func swap(x, y *int) {
	*x, *y = *y, *x
}

func operationPointer(x, y *int) {
	*x = *x + *y
	*y = *x - *y
}

func main() {
	var x, y int = 10, 5
	var f float64 = 1.23
	var s string = "Hello"

	var sum, diff int = sumAndDiff(x, y, f, s)

	fmt.Printf("%d 和 %d 的和是 %d，差是 %d\n", x, y, sum, diff)

	swap(&x, &y)
	fmt.Printf("交换后 x=%d, y=%d\n", x, y)

	operationPointer(&x, &y)
	fmt.Printf("操作指针后 x=%d, y=%d\n", x, y)
}
