Putting it together
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
English
Putting it together
- A real algorithm joins the pieces: arrays, loops and selection.
- The exam's standard methods are totalling, counting, linear search, and finding the maximum or minimum.
日本語
統合
- 実際のアルゴリズムは部品を組み合わせます:配列、ループ、選択です。
- 試験の 標準手法 は合計、カウント、線形探索、最大値または最小値の検索です。
DECLARE A : ARRAY[1:5] OF INTEGER
DECLARE I, Total : INTEGER
FOR I ← 1 TO 5
A[I] ← I * 10
NEXT I
Total ← 0
FOR I ← 1 TO 5
Total ← Total + A[I]
NEXT I
OUTPUT Total
Explore · 探索
Totalling an array
Totalling — start at 0, then add each array item as the loop visits it.
English
Searching and counting
- Linear search: check each item, and set a flag if you find the target.
- Counting: add 1 to a counter each time a rule is true.
日本語
探索とカウント
- 線形探索: 各要素を確認し、ターゲットを見つけたらフラグを立てます。
- カウント: 条件が真になるたびにカウンタに1を加えます。
DECLARE A : ARRAY[1:5] OF INTEGER
DECLARE I, Target : INTEGER
DECLARE Found : BOOLEAN
FOR I ← 1 TO 5
A[I] ← I * 10
NEXT I
Target ← 30
Found ← FALSE
FOR I ← 1 TO 5
IF A[I] = Target
THEN
Found ← TRUE
ENDIF
NEXT I
OUTPUT Found
English
Common mistakes
- Plan the structure before you write the pseudocode.
- Match the exam's keywords and layout exactly.
日本語
よくあるミス
- 擬似コードを書く前に構造を計画します。
- 試験のキーワードとレイアウトに完全に合わせます。
English
Now you try
- Each task uses an array that is filled for you — write the algorithm.
- Press Check answer to test it.
日本語
あなたも試してみよう
- 各タスクには既に埋め込まれた配列が使われます——アルゴリズムを書きます。
- Check answer を押して確認する。
The array A is filled for you. Total all 5 values and output Total = then the total (it is 25).
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
The array A is filled for you. Use a linear search to set Found to TRUE if 9 is in the array, then output Found.
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
The array A is filled for you. Count how many values are greater than 4, then output the count (it is 3).
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。