C/C++ C++ Program Problem: Solutions & Tips

  • Thread starter Thread starter Amr719
  • Start date Start date
  • Tags Tags
    C++ Program
AI Thread Summary
The discussion centers on confusion regarding the pseudocode related to a problem description. The initial query highlights a lack of understanding of the code's structure, specifically why certain values, like "units - 500" and "units - 1000," are used. The response clarifies that these lines in the code are a direct translation of the problem description, with "every unit in excess of 1000" being represented as "units - 1000." The conversation emphasizes the importance of understanding how the code reflects the problem's requirements.
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 pugwazup19755 and Amr719
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top