快轉到主要內容

題解

目錄

解題過程
#

首先宣告兩個變數 a 和 b(a 為藍隊得分 b 為紅隊得分):

int a, b;

接者輸入這兩個變數:

cin >> a >> b;

接著照題目的要求將答案輸出即可!

cout << "=== Scoreboard ===" << endl;
cout << "Blue Team: " << a << endl;
cout << "Red Team: " << b << endl;
cout << "==================";

完整程式碼如下

#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << "=== Scoreboard ===" << endl;
    cout << "Blue Team: " << a << endl;
    cout << "Red Team: " << b << endl;
    cout << "==================";
}
Piau 的筆記本
作者
Piau 的筆記本
希望我寫下來的東西能夠長久的記在我的腦中