高软lab2:menu

m0_73571223 2023-03-20 13:33:45

1.安装go环境

img

2.安装VScode插件

img

3.编写代码

package main

import "fmt"

func main() {
    for {
        fmt.Print("Please input a command: ")
        var cmd string
        fmt.Scanln(&cmd)
        switch cmd {
        case "help":
            fmt.Println("This is help command.")
            fmt.Println("We only have command 'hello' and 'quit'.")
        case "hello":
            fmt.Println("Hello.")
        case "quit":
            fmt.Println("Program ended.")
            return
        default:
            fmt.Println("Wrong!")
        }
    }
}

4.运行代码

img

5.上传到到github

img


尾号:5247

...全文
61 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

571

社区成员

发帖
与我相关
我的任务
社区描述
软件工程教学新范式,强化专项技能训练+基于项目的学习PBL。Git仓库:https://gitee.com/mengning997/se
软件工程 高校
社区管理员
  • 码农孟宁
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧