# 【GESP】C++一级练习BCQM3005，基本输出语句printf

> Author: OneCoder (李宏哲) | Canonical: https://www.coderli.com/gesp-1-bcqm3005/
> Published: 2024-09-11 | Topic: GESP C++ 编程考级 / 一级
> Tags: GESP, C++, 基础语句

一道基础练习题，练习基本输出语句`printf`。

## BCQM3005

### 题目要求

#### 描述

> 输出表达式1234∗5678的结果。

#### 输入

> 无

#### 输出

> 1234∗5678=7006652

#### 输入样例

> 无

#### 输出样例

```console
1234 * 5678 = 7006652
```

### 题目分析

题目本意自然不是计算好输出结果后再原样输出，而是要使用`printf`函数的格式化输出功能，通过程序自动计算出结果输出。

使用`printf`函数时需要引入头文件`<cstdio>`。

#### 代码参考

```cpp
#include <cstdio>

int main() {
    // %d 是整数占位符，printf 函数会用 1234 * 5678 的结果替换 %d
    printf("1234 * 5678 = %d", 1234 * 5678);
    return 0;
}
```

---

---
Source: OneCoder (https://www.coderli.com/gesp-1-bcqm3005/) | GESP Wiki: https://wiki.coderli.com/ | OI-Game: https://oi.coderli.com/
