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();
            }

        }

    }
  • 相关阅读:
    rabbitmq消息路由
    rabbitmq消息消费
    python中的正则匹配
    Spectral Grouping Using Nystrom Method
    基于WKPCA的多路谱聚类算法
    基于加权KPCA的谱聚类算法
    单词拆分
    完全平方数
    零钱兑换
    组合总数
  • 原文地址:https://www.cnblogs.com/simhare/p/919841.html
Copyright © 2011-2022 走看看