汇编版本电话本

 

demo.inc

; 头文件可以放置数据的定义和结构体
​
; 定义需要的结构体
UserContent struct
    ; 需要定义的数据
    user db 32 dup(0)
    tel db 16 dup(0)
UserContent ends
​
​
.data   ; 全局变量(静态变量区)
​
; 定义一个结构体数组,用于存放所有的联系人
contents UserContent 2 dup(<>)
​
; 用于保存菜单的选项
choose dd 0
​
; 当前最多能存放多少个数据
max_count dd 2
​
; 已经存放了多少个数据
count dd 0
​
; 用于保存用户名
user db 32 dup(0)
​
​
​
.const  ; 常量数据(常量数据区)
​
; 菜单项
str_show_menu db "1. 添加数据", 0dh, 0ah,
         "2. 显示数据", 0dh, 0ah,
         "3. 查找数据", 0dh, 0ah,
         "4. 退出程序", 0dh, 0ah,
         "请输入选项: ", 0
         ; 0dh 0ah == \r\n 0 字符串结尾
         
; 格式控制符
str_format_int db "%d", 0
​
; 格式控制符
str_format_str db "%s", 0
​
; 
str_printf_find db "请输入要查找的用户名: ", 0
​
; 清空屏幕
str_system_cls db "cls", 0
​
; 清空屏幕
str_printf_size db "超出容量", 0dh, 0ah, 0
​
; 提示输出
str_printf_info db "请输入联系人的信息: ", 0
​
; 输入格式控制符
str_fomat_info db "%s %s", 0
​
; 输出联系人信息
str_show_info db "%d: %s %s", 0dh, 0ah, 0
​
; 暂停
str_system_pause db "pause", 0dh, 0ah, 0
​
​
​

  


相关文章:

  • 2022-12-23
  • 2022-01-23
  • 2021-10-10
  • 2021-10-04
  • 2022-02-11
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-08-06
相关资源
相似解决方案