A1004. 画长方形2

这是一个C++程序,它根据用户输入的长度和宽度用特定字符画出长方形。程序首先定义了一个包含全部字母的字符数组,然后通过两层循环结构输出字符,形成指定大小的长方形。
摘要由CSDN通过智能技术生成
A1004. 画长方形2
时间限制: 1.0s   内存限制: 512.0MB  
问题描述
  在Windows的控制台环境中,所有的字符都是等宽的,默认情况下窗口中每行有80个字符,每个屏幕有25行,组成了一个字符矩阵。
  利用控制台的这个特点,我们可以在控制台上绘制简单的图形。下面给出了一个5*7的图形的例子:
  ABCDEFG
  BABCDEF
  CBABCDE
  DCBABCD <
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以这样解析出 map 的 fullDocument 的 OwnerID、name、QuotaSize: ``` package main import ( "fmt" "reflect" ) func main() { m := map[string]interface{}{ "_id": map[string]interface{}{ "_data": "8263B4EB63000000062B022C0100296E5A1004C3E4524B77B64630AC204C7469FAED7F46645F6964006463B4EB636EBBDB249F2ED2770004", }, "clusterTime": map[string]interface{}{ "1672801123": 6, }, "documentKey": map[string]interface{}{ "_id": "ObjectID(\"63b4eb636ebbdb249f2ed277\")", }, "fullDocument": map[string]interface{}{ "OwnerID": 123, "QuotaSize": 104857600, "_id": "ObjectID(\"63b4eb636ebbdb249f2ed277\")", "directory": "/buckets", "name": "123_test1", }, "ns": map[string]interface{}{ "coll": "UserQuotaConfig", "db": "filer3", }, "operationType": "insert", "wallTime": 1672801123879, } // 取出 fullDocument fullDocument, ok := m["fullDocument"].(map[string]interface{}) if !ok { fmt.Println("fullDocument not found") return } // 取出 OwnerID OwnerID, ok := fullDocument["OwnerID"].(int) if !ok { fmt.Println("OwnerID not found") return } fmt.Println("OwnerID:", OwnerID) // 取出 name name, ok := fullDocument["name"].(string) if !ok { fmt.Println("name not found") return } fmt.Println("name:", name) // 取出 QuotaSize QuotaSize, ok := fullDocument["QuotaSize"].(int) if !ok { fmt.Println("QuotaSize not found") return } fmt.Println("QuotaSize:", QuotaSize) } ``` 在这个例子,我们首先将 map 赋值给了变量 m。然后使用类型断言取出了 fullDocument 并将其赋
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值