標題:
2025/02/08 課堂重點(紘鳴)
[打印本頁]
作者:
李知易
時間:
2025-2-8 01:13
標題:
2025/02/08 課堂重點(紘鳴)
本帖最後由 李知易 於 2025-2-8 17:05 編輯
今日上課重點
(週六15:30 - 17:00)
f637. DF-expression
f640. 函數運算式求值
(V)
今日考試:
401 - 710
隨機 2 題
(603)AC
(709)
下次考試:
401 - 710
隨機 2 題
c071
以下與數學表達式 “0<x<5 且 x≠2” 不等價的 C 語言邏輯表達式是
A) (0<x<5) && (x!=2)
B) 0<x && x<5 && x!=2
C) x>0 && x<5 && x!=2
D) (x>0 && x<2) || (x>2 && x<5)
c072
有以下程式
#include <stdio.h>
main( ) {
int a, b;
for (a=0; a<3; a++){
scanf("%d", &b);
switch(b){
default:
printf("%d,",b+1);
continue;
case 1:
printf("%d,", b+1);
case 2:
printf("%d,", b+1);
continue;
}
}
}
複製代碼
執行時輸入:1 2 3,則輸出結果是
A) 2,2,3,4,4,4,
B) 2,3,4,
C) 2,2,3,4,
D) 2,3,3,4,5,6,
c073
有以下程式
#include <stdio.h>
main( )
{
int a=-2, b=2;
for(; ++a && --b;)
printf("%d,%d\n", a,b);
}
複製代碼
程式運行後的輸出結果是
A) 1,-1
B) 0,0
C) 0,1
D) 0,2
c074
有以下程式
#include <stdio.h>
main( )
{
int a=0, b=0;
for( ;a<7; a++ ) {
if (a%2==0)
continue;
b += a;
continue;
}
printf( “%d \n”, b );
}
複製代碼
程式運行後的輸出結果是
A) 0
B) 4
C) 1
D) 9
c075
以下選項中是非轉義字元的是
A) ’\d’
B) ’\t’
C) ’\b’
D) ’\r’
#include<bits/stdc++.h>
using namespace std;
int n, idx = -1;
string s;
int compute(int n)
{
idx++;
int ans = 0;
if()
return _;
if()
return _;
if(s[idx] == '2')
ans += compute(___) + compute(___)...;
return ans;
}
int main()
{
cin >> s >> n;
cout << compute(n) << endl;
return 0;
}
複製代碼
作者:
張紘鳴
時間:
2025-2-8 16:17
#include<bits/stdc++.h>
using namespace std;
string s;
char c;
int eval()
{
cin>>s;
if(s[0]<'A')
return stoi(s);
else
c=s[0];
if(c=='h')
{
return eval()*3-eval()*2+eval();
}
if(c=='g')
{
return eval()*2+eval()-7;
}
if(c=='f')
{
return eval()*2-3;
}
}
int main()
{
cout<<eval();
return 0;
}
複製代碼
作者:
張紘鳴
時間:
2025-2-8 16:25
ACCDA
複製代碼
作者:
李知易
時間:
2025-2-8 16:56
本帖最後由 李知易 於 2025-2-8 17:03 編輯
本帖隱藏的內容需要回復才可以瀏覽
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2