zoukankan      html  css  js  c++  java
  • switch_goto

    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace switch_goto
    {
        
    class SwitchTest
        
    {
            
    static void Main()
            
    {
                Console.WriteLine(
    "Coffee sizes: 1=Small 2=Medium 3=Large");
                Console.Write(
    "Please enter your selection: ");
                
    string s = Console.ReadLine();
                
    int n = int.Parse(s);
                
    int cost = 0;
                
    switch (n)
                
    {
                    
    case 1:
                        cost 
    += 25;
                        
    break;
                    
    case 2:
                        cost 
    += 25;
                        
    goto case 1;
                    
    case 3:
                        cost 
    += 50;
                        
    goto case 1;
                    
    default:
                        Console.WriteLine(
    "Invalid selection.");
                        
    break;
                }

                
    if (cost != 0)
                
    {
                    Console.WriteLine(
    "Please insert {0} cents.", cost);
                }

                Console.WriteLine(
    "Thank you for your business.");
                Console.ReadLine();
            }

        }

    }
  • 相关阅读:
    考试心得 模拟18
    模拟17 题解
    模拟16 题解
    考试心得 模拟17
    模拟15 题解(waiting)
    BZOJ2653 middle 【主席树】【二分】*
    BZOJ3932 CQOI2015 任务查询系统 【主席树】
    与或 【线段树】 *
    BZOJ1014 JSOI2008 火星人prefix 【非旋转Treap】*
    网络流--最大权闭合子图 *
  • 原文地址:https://www.cnblogs.com/simhare/p/919841.html
Copyright © 2011-2022 走看看