2019年6月26日 星期三

C語言(online c) 寫簡單的 程式 ( 請輸入1或2或3等數字輸入1出現剪刀 輸入2出現石頭 輸入3出現布 )

C語言(online c) 寫簡單的 程式 ( 請輸入1或2或3等數字輸入1出現剪刀  輸入2出現石頭  輸入3出現布 )

#include<stdio.h>
#include<math.h>

int main()
{
    int x;
 
    printf("請輸入1或2或3等數字(1/2/3):\n");
    scanf("%d", &x);
    printf("你輸入的 N=%3d\n",x);
 
    //=============================
    printf("\n13.出現的是:");
    if (x== 1)
        printf("剪刀\n",x);
    else
        if (x==2)
            printf("石頭\n",x);
        else
            if (x==3)
                printf("布\n",x);
            else
                printf("輸入錯誤\n",x);
             
     
    return 0;
}     


Stdin Inputs...
3
請輸入1或2或3等數字(1/2/3):
你輸入的 N=  3

13.出現的是:布

沒有留言:

張貼留言

Python Modbus 控制 ADAM-6050 18-ch Isolated Digital I/O Module

Python Modbus 控制  ADAM-6050 18-ch Isolated Digital I/O Module import tkinter as tk from tkinter import messagebox from pymodbus.client impor...