2018-11-21

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication4

{

? ? class Program

? ? {

? ? ? ? static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? string strNumber = "";//存儲(chǔ)的用戶的輸入

? ? ? ? ? ? do

? ? ? ? ? ? {

? ? ? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入數(shù)字");

? ? ? ? ? ? ? ? strNumber = Console.ReadLine();//數(shù)字? q? ? 亂七八糟

? ? ? ? ? ? ? ? if (strNumber != "q")//數(shù)字? 亂七八糟

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? try

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? int number = Convert.ToInt32(strNumber);

? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("這個(gè)數(shù)字的2倍是{0}", number * 2);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? catch//輸入的是亂七八糟

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? Console.WriteLine("輸入有誤,請(qǐng)重新輸入");

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? else//==q

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? Console.WriteLine("你輸入的是q,程序退出?。?!");

? ? ? ? ? ? ? ? }

? ? ? ? ? ? } while (strNumber != "q");

? ? ? ? ? ? Console.ReadKey();

? ? ? ? }

? ? }

}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • using System; using System.Collections.Generic; using Sys...
    零二幺五閱讀 238評(píng)論 0 0
  • using System; using System.Collections.Generic; using Sys...
    南川_3193閱讀 118評(píng)論 0 0
  • 循環(huán)結(jié)構(gòu) 要么痛苦的堅(jiān)持游戲結(jié)束 可能會(huì)升級(jí) 要么結(jié)束游戲繼續(xù)的痛苦 可能有遺憾 知識(shí)點(diǎn) (1) . whil...
    拾起_518閱讀 420評(píng)論 0 0
  • using System; using System.Collections.Generic; using Sys...
    追魂_409e閱讀 161評(píng)論 0 0
  • 這個(gè)周末我們沒(méi)回老家, 周五晚上,和周六一整天,我都在學(xué)習(xí)魔方。到現(xiàn)在我學(xué)會(huì)了三種魔方,孫子淳學(xué)會(huì)了五種魔方。 我...
    軒小豆閱讀 258評(píng)論 0 0

友情鏈接更多精彩內(nèi)容