Board logo

标题: [特效代码] (已解决)批处理制作点餐菜单 [打印本页]

作者: panda951    时间: 2015-3-16 14:01     标题: (已解决)批处理制作点餐菜单

本帖最后由 panda951 于 2015-3-16 15:48 编辑

这个是我想出来的...
缺--选他里面其中一个要用什么符号/代码/数字弄到去加...
:food
:sup
:drink
只选一个就可以了
  1. @echo off
  2. echo happy happy menu
  3. echo list
  4. :drink
  5. echo --------------------------------------
  6. set kopi=1
  7. set lemon tea=1
  8. set ice tea=2
  9. set tea=5
  10. set durian tea=7
  11. set grape tea=10
  12. echo drink
  13. echo kopi RM1
  14. echo lemon tea RM1
  15. echo ice tea RM2
  16. echo tea RM5
  17. echo durian tea RM7
  18. echo grape tea RM10
  19. echo pls choice your drink(1-6):
  20. set /p drink=
  21. echo --------------------------------------
  22. :food
  23. echo --------------------------------------
  24. set nasi=5
  25. set mee=9
  26. set nasi lemak=11
  27. set mee lemak=22
  28. set nasi lemak goreng=33
  29. set meel lemak goreng=100
  30. echo food
  31. echo nasi RM5
  32. echo mee RM9
  33. echo nasi lemak RM11
  34. echo mee lemak RM22
  35. echo nasi lemak goreng RM33
  36. echo meel lemak goreng RM100
  37. echo pls choice your food(1-6):
  38. set /p food=
  39. echo --------------------------------------
  40. :sup
  41. echo --------------------------------------
  42. set kamping=7
  43. set ikan=8
  44. set ayam=10
  45. set sotong=12
  46. set sea food=16
  47. set kamping vs ayam=18
  48. echo sup
  49. echo kamping RM7
  50. echo ikan RM8
  51. echo ayam Rm10
  52. echo sotong RM12
  53. echo sea food RM16
  54. echo kamping vs ayam RM18
  55. echo pls choice your sup(1-6):
  56. set /p sup=
  57. echo --------------------------------------
  58. echo --------------------------------------
  59. set service charge=5
  60. echo service charge RM 5
  61. echo --------------------------------------
  62. pls comfirm your order:
  63. echo food
  64. echo
  65. echo drink
  66. echo
  67. echo sup
  68. echo
  69. set /a total=%drink%+%food%+%sup%
  70. echo  total RM%total%
  71. echo total you have to pay:
  72. set /a total1=%drink%+%food%+%sup%+%service charge%
  73. echo total have you to pay:
  74. echo RM%total1%
  75. pause
复制代码

作者: panda951    时间: 2015-3-16 14:03

有错麻烦纠正下...
作者: panda951    时间: 2015-3-16 14:07

例如

:food里面选1-6
1)xxx
2)zzz
3)ccc
4)vvv
5)bbb
6)nnn
作者: panda951    时间: 2015-3-16 14:09

附加 用什么方法都可以
作者: panda951    时间: 2015-3-16 14:31

  1. @echo off
  2. echo happy happy menu
  3. echo list
  4. :drink
  5. echo --------------------------------------
  6. set kopi=1  
  7. set lemon tea=1
  8. set ice tea=2
  9. set tea=5
  10. set durian tea=7
  11. set grape tea=10
  12. echo drink
  13. echo kopi RM1
  14. echo lemon tea RM1
  15. echo ice tea RM2
  16. echo tea RM5
  17. echo durian tea RM7
  18. echo grape tea RM10
  19. echo pls choice your drink(1-6):
  20. set /p drink=
  21. echo --------------------------------------
  22. :food
  23. echo --------------------------------------
  24. set nasi=5
  25. set mee=9
  26. set nasi lemak=11
  27. set mee lemak=22
  28. set nasi lemak goreng=33
  29. set meel lemak goreng=100
  30. echo food
  31. echo nasi RM5
  32. echo mee RM9
  33. echo nasi lemak RM11
  34. echo mee lemak RM22
  35. echo nasi lemak goreng RM33
  36. echo meel lemak goreng RM100
  37. echo pls choice your food(1-6):
  38. set /p food=
  39. echo --------------------------------------
  40. :sup
  41. echo --------------------------------------
  42. set kamping=7
  43. set ikan=8
  44. set ayam=10
  45. set sotong=12
  46. set sea food=16
  47. set kamping vs ayam=18
  48. echo sup
  49. echo kamping RM7
  50. echo ikan RM8
  51. echo ayam Rm10
  52. echo sotong RM12
  53. echo sea food RM16
  54. echo kamping vs ayam RM18
  55. echo pls choice your sup(1-6):
  56. set /p sup=
  57. echo --------------------------------------
  58. echo --------------------------------------
  59. set service charge=5
  60. echo service charge RM 5
  61. echo --------------------------------------
  62. echo pls comfirm your order:
  63. echo food
  64. echo %food%
  65. echo drink
  66. echo %drink%
  67. echo sup
  68. echo %sup%
  69. set /a total=%drink%+%food%+%sup%
  70. echo  total RM%total%
  71. echo total you have to pay:
  72. set /a total1=%drink%+%food%+%sup%+%service charge%
  73. echo RM%total1%
  74. pause
复制代码
发现一点点小错误(已修改)
还是不懂怎样set 两个在一起.....

如 set food=rm4 他也要是1号....
作者: pcl_test    时间: 2015-3-16 15:10

本帖最后由 pcl_test 于 2015-3-16 15:36 编辑

回复 2# panda951
  1. @echo off
  2. echo happy happy menu
  3. echo list
  4. echo --------------------------------------
  5. echo drink list :
  6. echo 1、kopi RM1
  7. echo 2、lemon tea RM1
  8. echo 3、ice tea RM2
  9. echo 4、tea RM5
  10. echo 5、durian tea RM7
  11. echo 6、grape tea RM10
  12. echo.
  13. :drink
  14. echo pls choice your drink(1-6):
  15. set /p drink=
  16. if not defined drink goto drink
  17. set dbill=0 & set d=null
  18. if %drink% == 1 set dbill=1 & set d=kopi
  19. if %drink% == 2 set dbill=1 & set d=lemon tea
  20. if %drink% == 3 set dbill=2 & set d=ice tea
  21. if %drink% == 4 set dbill=3 & set d=tea
  22. if %drink% == 5 set dbill=4 & set d=durian tea
  23. if %drink% == 6 set dbill=10 & set d=grape tea
  24. echo --------------------------------------
  25. echo --------------------------------------
  26. echo food list :
  27. echo 1、nasi RM5
  28. echo 2、mee RM9
  29. echo 3、nasi lemak RM11
  30. echo 4、mee lemak RM22
  31. echo 5、nasi lemak goreng RM33
  32. echo 6、meel lemak goreng RM100
  33. echo.
  34. :food
  35. echo pls choice your food(1-6):
  36. set /p food=
  37. if not defined food goto food
  38. set fbill=0 & set f=null
  39. if %food% == 1 set fbill=5 & set f=nasi
  40. if %food% == 2 set fbill=9 & set f=mee
  41. if %food% == 3 set fbill=11 & set f=nasi lemak
  42. if %food% == 4 set fbill=22 & set f=mee lemak
  43. if %food% == 5 set fbill=33 & set f=nasi lemak goreng
  44. if %food% == 6 set fbill=100 & set f=meel lemak goreng
  45. echo --------------------------------------
  46. echo --------------------------------------
  47. echo sup list :
  48. echo 1、kamping RM7
  49. echo 2、ikan RM8
  50. echo 3、ayam Rm10
  51. echo 4、sotong RM12
  52. echo 5、sea food RM16
  53. echo 6、kamping vs ayam RM18
  54. echo.
  55. :sup
  56. echo pls choice your sup(1-6):
  57. set /p sup=
  58. if not defined sup goto sup
  59. set sbill=0 & set s=null
  60. if %sup% == 1 set sbill=7 & set s=nasi
  61. if %sup% == 2 set sbill=8 & set s=mee
  62. if %sup% == 3 set sbill=10 & set s=nasi lemak
  63. if %sup% == 4 set sbill=12 & set s=mee lemak
  64. if %sup% == 5 set sbill=16 & set s=nasi lemak goreng
  65. if %sup% == 6 set sbill=18 & set s=meel lemak goreng
  66. echo --------------------------------------
  67. echo --------------------------------------
  68. echo pls comfirm your order:
  69. echo food: ^<%f%^>
  70. echo drink: ^<%d%^>
  71. echo sup: ^<%s%^>
  72. echo --------------------------------------
  73. set /a total=%dbill%+%fbill%+%sbill%
  74. echo total: RM%total%
  75. if %total% == 0 (set sc=0) else (set sc=5)
  76. echo service charge: RM%sc%
  77. echo --------------------------------------
  78. echo total you have to pay:
  79. set /a total1=%total%+%sc%
  80. echo RM%total1%
  81. pause
复制代码

作者: panda951    时间: 2015-3-16 15:42

回复 6# pcl_test


    如果要在echo pls comfirm your order:
这边显示出
echo food: ^<%f%^>
echo drink: ^<%d%^>
echo sup: ^<%s%^>
的价钱大概要怎样做?
作者: panda951    时间: 2015-3-16 15:47

回复 6# pcl_test


    不用了 已找到方法 感谢帮忙
作者: panda951    时间: 2015-3-16 15:50

回复 6# pcl_test


    暂时无法给你评分 晚点补上
作者: pcl_test    时间: 2015-3-17 13:22

回复 8# panda951

你试试不用if ,只用goto、set、set /p、echo、pause,能不能做出跟我6楼代码同样的效果
作者: panda951    时间: 2015-3-18 14:32

回复 10# pcl_test

我用这个
  1. @echo off
  2. echo happy happy menu
  3. echo list
  4. ::drink
  5. echo --------------------------------------
  6. echo drink list :
  7. echo 1、kopi RM1
  8. echo 2、lemon tea RM1
  9. echo 3、ice tea RM2
  10. echo 4、tea RM5
  11. echo 5、durian tea RM7
  12. echo 6、grape tea RM10
  13. echo.
  14. echo pls choice your drink(1-6):
  15. set /p drink=
  16. if %drink% == 1 set dbill=1 & set d=kopi
  17. if %drink% == 2 set dbill=1 & set d=lemon tea
  18. if %drink% == 3 set dbill=2 & set d=ice tea
  19. if %drink% == 4 set dbill=3 & set d=tea
  20. if %drink% == 5 set dbill=4 & set d=durian tea
  21. if %drink% == 6 set dbill=10 & set d=grape tea
  22. echo --------------------------------------
  23. ::food
  24. echo --------------------------------------
  25. set nasi=5
  26. set mee=9
  27. set nasi lemak=11
  28. set mee lemak=22
  29. set nasi lemak goreng=33
  30. set meel lemak goreng=100
  31. echo food list :
  32. echo 1、nasi RM5
  33. echo 2、mee RM9
  34. echo 3、nasi lemak RM11
  35. echo 4、mee lemak RM22
  36. echo 5、nasi lemak goreng RM33
  37. echo 6、meel lemak goreng RM100
  38. echo pls choice your food(1-6):
  39. set /p food=
  40. if %food% == 1 set fbill=5 & set f=nasi
  41. if %food% == 2 set fbill=9 & set f=mee
  42. if %food% == 3 set fbill=11 & set f=nasi lemak
  43. if %food% == 4 set fbill=22 & set f=mee lemak
  44. if %food% == 5 set fbill=33 & set f=nasi lemak goreng
  45. if %food% == 6 set fbill=100 & set f=meel lemak goreng
  46. echo --------------------------------------
  47. ::sup
  48. echo --------------------------------------
  49. set kamping=7
  50. set ikan=8
  51. set ayam=10
  52. set sotong=12
  53. set sea food=16
  54. set kamping vs ayam=18
  55. echo sup list :
  56. echo 1、kamping RM7
  57. echo 2、ikan RM8
  58. echo 3、ayam Rm10
  59. echo 4、sotong RM12
  60. echo 5、sea food RM16
  61. echo 6、kamping vs ayam RM18
  62. echo pls choice your sup(1-6):
  63. set /p sup=
  64. if %sup% == 1 set sbill=7 & set s=nasi
  65. if %sup% == 2 set sbill=8 & set s=mee
  66. if %sup% == 3 set sbill=10 & set s=nasi lemak
  67. if %sup% == 4 set sbill=12 & set s=mee lemak
  68. if %sup% == 5 set sbill=16 & set s=nasi lemak goreng
  69. if %sup% == 6 set sbill=18 & set s=meel lemak goreng
  70. echo --------------------------------------
  71. echo --------------------------------------
  72. echo pls comfirm your order:
  73. echo food: ^<%f%^>    RM%fbill%
  74. echo drink: ^<%d%^>   RM%dbill%
  75. echo sup: ^<%s%^>     RM%sbill%
  76. echo --------------------------------------
  77. set /a total=%dbill%+%fbill%+%sbill%
  78. echo total: RM%total%
  79. set sc=5
  80. echo service charge: RM 5
  81. echo --------------------------------------
  82. echo total you have to pay:
  83. set /a total1=%total%+%sc%
  84. echo RM%total1%
  85. pause
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2