move: funcs and ptrs to root
This commit is contained in:
		
							
								
								
									
										39
									
								
								26-functions-and-pointers/04-pass-by-value-semantics/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								26-functions-and-pointers/04-pass-by-value-semantics/main.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| // For more tutorials: https://blog.learngoprogramming.com | ||||
| // | ||||
| // Copyright © 2018 Inanc Gumus | ||||
| // Learn Go Programming Course | ||||
| // License: https://creativecommons.org/licenses/by-nc-sa/4.0/ | ||||
| // | ||||
|  | ||||
| package main | ||||
|  | ||||
| import ( | ||||
| 	"bufio" | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| ) | ||||
|  | ||||
| func main() { | ||||
| 	in := bufio.NewScanner(os.Stdin) | ||||
|  | ||||
| 	p := newParser() | ||||
|  | ||||
| 	for in.Scan() { | ||||
| 		p.lines++ | ||||
|  | ||||
| 		d, err := parse(p, in.Text()) | ||||
| 		if err != nil { | ||||
| 			fmt.Println(err) | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| 		p = push(p, d) | ||||
| 	} | ||||
|  | ||||
| 	for _, d := range p.domains { | ||||
| 		vis := p.sum[d.name] | ||||
|  | ||||
| 		fmt.Printf("%-25s -> %d\n", d.name, vis) | ||||
| 	} | ||||
| 	fmt.Printf("\n%-25s -> %d\n", "TOTAL", p.total) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user