打印小票
2016-09-11 17:38
99 查看
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(); } } }
相关文章推荐
- 订单小票打印模板
- ActiveX控件的使用-js实现打印超市小票功能代码详解
- POS小票打印[转]
- 网页端如何通过JS实现超市小票打印功能(含附代码)
- POS小票打印且自动弹出钱箱
- C# 热敏打印机 小票打印机 打印图片
- 手持式便携热敏小票打印机 解锁迷你纸条打印到底多有趣
- C#小票打印(通用)
- php 打印小票模板
- Qt小票打印之网口程序
- iOS Bluetooth 打印小票(二)
- 小票打印机打印出空白
- C#并口热敏小票打印机打印位图
- Java调用热敏票据打印机打印小票
- 打印小票的一段程序
- 手把手教你 小程序外卖如何对接无线云小票打印机实现自动接单打印
- JFinal小插件:Java驱动打印小票(80热敏打印机)
- 打印小票,使用的是BarcodeLib
- C# winform小票打印
- (商用版)对对机如何打印自动饿了么外卖订单小票教程