舊IF ELSE 練習

Console.WriteLine("數學測驗,滿分三分,每題一份,錯誤則倒扣");

Console.Write("2+3*5=");

int score = 0;

int result01 = (Convert.ToInt32(Console.ReadLine()));

if (result01 == 17) {
    Console.WriteLine("答案正確"); 
    score ++;}
else {
    Console.WriteLine("答案錯誤"); 
    score --;}

Console.Write("7*3-3=");

int result02 = (Convert.ToInt32(Console.ReadLine()));

if (result02 == 18) { 
    Console.WriteLine("答案正確");
    score++;}

else{
    Console.WriteLine("答案錯誤");
    score --;}

Console.Write("(7+3)/5");

int result03 = (Convert.ToInt32(Console.ReadLine()));

if (result03 == 5){
    Console.WriteLine("答案正確");
    score ++;}

else{
    Console.WriteLine("答案錯誤");
    score --;}

Console.WriteLine("總分:" + score + " 分");

Console.ReadKey();

大腦抽筋時寫的東西

 Console.WriteLine("你媽與地下城");

 Console.Title = ("你媽與地下城");

 Console.ForegroundColor = ConsoleColor.Red;
 Console.WriteLine(
     "一日,你從恍惚中醒來,\\n 發現自己身處於一個地窖之中,而眼前只有一扇門,\\n身旁有著一個櫃子,地上正是你所躺的草蓆。");
 Console.ForegroundColor = ConsoleColor.DarkGreen;
 Console.WriteLine("這時,你要做什麼?\\n1.檢查櫃子的抽屜 2.檢查四周與草蓆 3. 查看門與門上的窗戶");

 Console.ForegroundColor = ConsoleColor.Yellow;
 Console.Write("請輸入你的選擇(數字1/2/3):");
 
 int choice = Convert.ToInt32(Console.ReadLine());

 Console.ForegroundColor = ConsoleColor.Red;
 if (choice == 1)
 {
     Console.WriteLine(
         "你走到櫃子的抽屜,發現裡面有一把鑰匙以及一張照片:\\n「是個有點眼熟的小男孩與成年女性,是誰?」");
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.Write("這時候你該?\\n 1.拿起鑰匙前門口查看 2. 不要亂拿別人的東西好了:");
     int choice2 = Convert.ToInt32(Console.ReadLine());

     if (choice2 == 1)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("「三小阿鑰匙孔又對不上,沒孔說個姬芭。」/n當你這麼說時,餘光卻喵見有道人影緩緩從門後走來。 \\n 他的眼神非常不善讓你感到害怕。");
         Console.ForegroundColor = ConsoleColor.Yellow;
         Console.Write("你該?\\n 1. 先聲奪人,對著監視窗偷襲!2.");
     }

 }
 else if (choice == 2)
 {
     Console.WriteLine(
         "你把草蓆翻開,發現下方夾著一張紙與少許現金 \\n 紙張用塗鴉表示:將錢遞給門後的傢伙。\\n\\n這時,門口傳來了撞擊的聲音,你發現一雙眼睛正兇惡的盯著你看");
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.Write("你該?\\n 1. 看三小,戳你眼睛 2. 趕快把錢遞給門後的傢伙:");
     int choice3 = Convert.ToInt32(Console.ReadLine());
            
 }
 else if (choice == 3)
 {
     Console.WriteLine("你走到門前,發現門前上鎖,外面有人來回的腳步聲。\\n這門似乎殘破不堪,應該輕易就可以敲破");
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.Write("你該?\\n 1. 輕輕呼喚吸引注意 2. 強力撞擊撞開上鎖的門");
     int choice4 = Convert.ToInt32(Console.ReadLine());
 }
 else
 {
     Console.WriteLine("你選擇坐在原地靜靜思考人生\\n. \\n. \\n. \\n. \\n. \\n. \\n.\\n鬧鐘響起,\\n該起床了 \\n \\nEND01:夢醒時分");
 }

 

 Console.ReadKey();