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

        }

    }
  • 相关阅读:
    阿里云服务器,http免费转https详细教程
    springboot系列总结(二)---springboot的常用注解
    springboot系列总结(一)---初识springboot
    java 查询当天0点0分0秒
    mysql各个版本驱动jar包下载 mysql/mysql-connector-java/5.1.22
    泰坦尼克 学习
    切片
    忽略warning 警告
    迭代 递归 循环 遍历
    标准化 归一化
  • 原文地址:https://www.cnblogs.com/simhare/p/919841.html
Copyright © 2011-2022 走看看