Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var data = map[string]mahasiswa {
- "11119829" : {
- "Dimas Raihan Pratama",
- "4KA21",
- },
- "11112222" : {
- "Ahmad Fulan",
- "4KA01",
- },
- }
- var search string
- fmt.Print("Masuukan NPM Anda: ")
- fmt.Scanf("%s", &search)
- var value, ok = data[search]
- if ok {
- fmt.Printf("Nama Anda %s \nKelas Anda %s", value.Nama, value.Kelas)
- } else {
- fmt.Println("Data Tidak Ditemukan")
- }
- }
- type mahasiswa struct {
- Nama string
- Kelas string
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement