Description
Please write a function named Calculate. The function will take in 10 numbers and the arithmetic operator (+ or -) to be performed. Please calculate the resultand return it.
請撰寫一個函式Calculate,函式將輸入10筆數字與要進行的運算符號(+ 或 -),請計算出結果並回傳。
Input
The input of the function consists of an array of structures containing 10 sets of numbers and arithmetic operators.
函式的輸入包含一個結構陣列,包含10組的數字與運算符號。
Output
Please**"return"**the result of the calculation. You don't need to print anything in this problem.
請**"回傳"**計算後得到的答案。不需要印出任何東西。
Sample Input 1
1 +
2 +
3 -
1 +
2 +
3 -
1 +
2 +
3 -
10 +
Sample Output 1
10
Hint
你可以使用以下main來進行測試。
You can use this main to test.
int main(){
struct number num[11];
for(int i = 0 ; i < 10 ; i++)
scanf("%d %c", &num[i].n, &num[i].symbol);
printf("%d", Calculate(num));
}