GESP C++ Level 1 Daily Problem: Buying Stationery

GESP C++ Level 1 Daily Problem: Buying Stationery

Problem Description

GESP C++ Level 1 Daily Problem: Buying StationeryGESP C++ Level 1 Daily Problem: Buying Stationery

Problem Analysis

1

Knowledge Points

Input and Output Operations

Variable Definition

Conditional Statements

2

Problem Analysis

Reading Input

Cost Calculation

Comparison Judgement

Read four integers from standard input, representing the number of pens X, the number of notebooks Y, the number of rulers Z, and the amount of money Q that Xiao Ming has.

Based on the given unit prices (pens 2 yuan each, notebooks 5 yuan each, rulers 3 yuan each), calculate the total cost of purchasing all stationery.

Compare the total cost with the amount of money Q that Xiao Ming has. If the total cost is less than or equal to Q, output True, indicating that there is enough money; otherwise, output False, indicating that there is not enough money.

GESP C++ Level 1 Daily Problem: Buying Stationery

Swipe left to see more

GESP C++ Level 1 Daily Problem: Buying StationeryGESP C++ Level 1 Daily Problem: Buying Stationery

Final Code

GESP C++ Level 1 Daily Problem: Buying StationeryGESP C++ Level 1 Daily Problem: Buying StationeryGESP C++ Level 1 Daily Problem: Buying StationeryGESP C++ Level 1 Daily Problem: Buying Stationery

WeChat IDδΈ¨yoyolaoshijbc

Leave a Comment