C++ Program Problem: Solutions & Tips

  • Context: C/C++ 
  • Thread starter Thread starter Amr719
  • Start date Start date
  • Tags Tags
    C++ Program
Click For Summary

Discussion Overview

The discussion revolves around understanding specific lines of code in a C++ program, particularly focusing on the interpretation of variable assignments and their relation to a problem description. The scope includes technical explanation and clarification of coding practices.

Discussion Character

  • Technical explanation, Conceptual clarification

Main Points Raised

  • One participant expresses confusion about certain lines of code, specifically the values assigned to the variable "units."
  • Another participant suggests that the lines in blue provide a clear explanation of the pseudocode, questioning whether the initial confusion stems from the problem description itself.
  • A participant clarifies that the expression "every unit in excess of 1000" corresponds to the calculation (units - 1000), indicating that the code reflects the problem description directly.

Areas of Agreement / Disagreement

The discussion shows some disagreement regarding the understanding of the code's structure and its relation to the problem description, with no consensus reached on the clarity of the code.

Contextual Notes

Participants have not fully resolved the assumptions behind the code's variable assignments, and there may be dependencies on specific interpretations of the problem description.

Amr719
Messages
31
Reaction score
0
Untitled.png
 
Technology news on Phys.org
I cannot Understand the marked lines
 
The lines in blue in your image pretty well explain what is happening in the pseudocode. Are you having trouble understanding the problem description?
 
No I understand the description. But I don't understand the form of writing the code . Why in the first line he wrote units -500 and why in the second line he wrote units - 1000
 
"every unit in excess of 1000" is (units - 1000)

So the code is a direct translation of the description above.
 
  • Like
Likes   Reactions: pugwazup19755 and Amr719

Similar threads

Replies
69
Views
10K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 17 ·
Replies
17
Views
2K
Replies
86
Views
2K
  • · Replies 1 ·
Replies
1
Views
660
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K