2 like 0 dislike
3.5k views
小學一年級的數學

剛開始學習數學的時候,我們都是從個位數的加減乘除開始學習的,請寫一個程式,教你的程式學會個位數的加減乘除。

輸入說明:

程式會輸入三個字元,代表一個算式,會用下面的樣式呈現

運算元 運算子 運算元

其間會用單一個空白隔開,運算元是一個個位數的數子,運算子可能是+-*/中的任何一個。

輸出說明:

請輸出輸入算式的結果到整數位數

輸入範例:

1 +  2

輸出範例:

3
[Exercise] Coding (C) - asked in 2017-1 程式設計(一)AD by (18k points)
ID: 31085 - Available when: Unlimited - Due to: Unlimited

edited by | 3.5k views

23 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

int main (void)
{
    int a,c;
* ** ** * * * ** b;
***** * * * **** **** * ** %c * ******* *** * **** *
* ** **** ******** **** * *
* ** ** ** * ** ** **** * * *** * * ** * **** *
* ** *** ** *** * ** * * **** * * ** *
    else if(b=='-')
** * ** * **** ** * ** ** * **** ****** * * ** * *
* ** ** ** * * * * * ** ** ** *** * **
** * * * * * * *** if(b=='*')
* ** * * *** * * * * * ** * *** * ** * * **
*** *** *** * ** * *** ***** * * * *
** ** *** ** * *** * if(b=='/')
** ** ** ** ** * **** **** ** ** * * * ** ** ** * * ***
* ***** * * **** * ** * * * * * ***
* * * *** ***** *** * **** *** 0;
}
answered by (144 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main (void)
{
    int a,c;
******* * ** ** * ** *** * b;
***** *** * *** * ** *** **** %c **** ***** * * * ** ** *
* * * *** ** ** *****
** ** ***** **** * ***** * * **** ** * * * *** * * * * * **
* ** *********** ** *** *** ***** * * *** **
    else if(b=='-')
***** *** * * ****** ** ** * ***** * ** *** * ** * * *
*** * * * * * * * ****** ** ** *
    else if(b=='*')
**** * ** *** * * * ** * * ** * *********** * * * *** **
* * *** ******* ** * * * *** *
* * * *** ** if(b=='/')
* *** ***** * * *** **** * ** *** * ** * * *** * * *
* * * * *** * ** * * ** ******
* * *** * ** * ** * * ** *** ** * *** * **
*** *** * * ** * ** * ***** 0;
}
answered by (144 points)
0 0
prog.c: In function 'main':
prog.c:20:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main(){
    int a,b,ans;
*** * ** * * *** ******* ch;
* ** * * ** ** *** * * * *
    
* **** ** * * **** ** ** ** ** * * * ** * ** * *** *** *** * ** ** * *** *
* ****** * ** * * *** * * * **** %c * * **** **** * * * * *
    
** ** *** * ** ** ** ***** * *
* * * * *** * ** * * * * * ** *
* * * * * * * ** * ** * ** ** * * * **** *** * ******* **
    }
*** * ** * *** ******* * **
* * * * * ** ** * * * ***** *** * * * ** *
* **** * *** ** * *** * * ** *** ****** ** *** **** ** * ** ** *
    }
****** **** *** ** * ** *
* * ** *** ** * ** * ** *** ** *****
* * * *** * ** * * * ** * ***** * **** ** *
    }
* * **** * * * * * * *
* * ****** ** ** *** * * *** ** *
********* * * * * ***** **** * * ** * * ** **** **** * ** * ***** *****
*** * *** * *** *** ** * * ** * * * *** * ***
**** * ** ** * * ******* * ** * *
* ** ****** *** * * * ** * * * ** * *****
****** * * * * * ***** *** * ** *** * * * ** ** * * ** * ***
* * * **** * ** * ** * * ** * * *** * *** ***
    }
    
}
** * ***** ** ** ** ** ****** ** *******
}
answered by (192 points)
0 0
prog.c: In function 'main':
prog.c:34:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.117
©2016-2025

Related questions

2 like 0 dislike
29 answers
[Exercise] Coding (C) - asked Nov 9, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 31094 - Available when: Unlimited - Due to: Unlimited
| 4.3k views
2 like 0 dislike
31 answers
[Exercise] Coding (C) - asked Nov 9, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 31088 - Available when: Unlimited - Due to: Unlimited
| 5.2k views
3 like 0 dislike
9 answers
[Exercise] True/False - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 33763 - Available when: 2017-11-16 14:00 - Due to: 2017-11-16 14:30
| 734 views
3 like 0 dislike
9 answers
[Exercise] True/False - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 33764 - Available when: 2017-11-16 14:00 - Due to: 2017-11-16 14:30
| 799 views
1 like 0 dislike
0 answers
[Resource] asked Jan 4, 2018 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 40762 - Available when: Unlimited - Due to: Unlimited
| 26 views
12,783 questions
183,442 answers
172,219 comments
4,824 users