打印小票
来源:互联网 发布:linux将utf8转换为gbk 编辑:程序博客网 时间:2024/04/30 07:31
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Day04{ public class Show { public string names; public double prices; Show[] shop = new Show[3]; public void Showinfo() { shop[0] = new Show(); shop[0].names = "农夫山泉"; shop[0].prices = 1.03; shop[1] = new Show(); shop[1].names = "今麦郎碗面"; shop[1].prices = 3.50; shop[2] = new Show(); shop[2].names = "双汇火腿肠"; shop[2].prices = 12.60; Console.WriteLine("编号\t商品名称\t单价"); for (int i = 0; i < shop.Length; i++) { Console.WriteLine((i + 1) + "\t" + shop[i].names + "\t" + shop[i].prices); } } public void Show1() { int[] num = new int[30]; int[] num1 = new int[30]; string answer=""; do { Console.WriteLine(); for (int i = 0; i < num.Length; i++) { Console.Write("请输入商品标号:"); num[i] =int .Parse( Console.ReadLine()); Console.Write("请输入数量:"); num1[i] = int.Parse(Console.ReadLine()); Console.Write("输入e停止购物,输入其他的任意键继续购物:"); answer = Console.ReadLine(); Console.WriteLine(); if ("e".Equals(answer)) { break; } } break; } while (!("e".Equals(answer))); Console.WriteLine("===============欢迎光临光辉超市================"); Console.WriteLine("商品名称\t单价\t数量\t小计"); double sum = 0; do { for (int i = 0; i < num.Length; i++) { if (num[i] != 0) { Console.WriteLine(shop[num[i] - 1].names + "\t" + shop[num[i] - 1].prices + "\t" + num1[i]+"\t"+num1[i]* shop[num[i] - 1].prices ); sum = sum + num1[i] * shop[num[i] - 1].prices; } } } while (!("e".Equals(answer))); Console.WriteLine(); Console.WriteLine("小计:"+sum); } } class Program { static void Main(string[] args) { Show show = new Show(); show.Showinfo(); show.Show1(); Console.ReadLine(); } }}
0 0
- POS小票打印
- POS小票打印
- c#小票打印
- 打印小票
- 小票乱码打印
- 小票打印代码
- 蓝牙打印小票
- 打印小票
- 打印小票
- 购物小票打印
- (转)小票打印
- C# 打印小票 POS
- C# 小票打印源码
- Qt进行小票打印
- 收音机小票打印程序
- C# winform小票打印
- USB小票打印解决办法
- qt实现小票打印
- mysql错误代码大全
- 字典(dictionary)的设计
- Python 进阶_闭包 & 装饰器
- 我刚刚在看模电
- Ubuntu下安装JDK的两种方法
- 打印小票
- JavaSE入门开发常见问题
- 线性代数复习 第二章 矩阵
- 人机猜拳
- Android官方开发文档Training系列课程中文版:布局性能优化之按需加载View
- Codeforces-513A-Game
- 简单数据类型和复杂数据类型值传递
- 【脚本】Useful collection of linux bash scripts
- sqlMapConfig.xml配置文件详解