Q: Why do game companies use C++?
A: C++ combines speed, low-level hardware access, and high-level constructs better than just about any other language. In addition, most games companies have a lot invested in C++ resources (both in reusable code and programming experience).
Q: How is C++ different than C?
A: C++ is the next iteration of the C programming language. To gain acceptance, C++ essentially retained all of C. However, C++ defines new ways to do things that can replace some of the traditional C mechanisms. In addition, C++ adds the ability to write object-oriented programs.
Q How should I use comments?
A: To explain code that is unusual or unclear. You should not comment the obvious.
Q. What's a programming block?
A: One or more statements surrounded by curly braces that form a single unit.
Q: What's a compiler warning?
A: A message from your compiler stating a potential problem. A warning will not stop the compilation process.
Q: Can I ignore compiler warnings?
A: You can, but you shouldn't. You should address the warning and fix the offending code
Q: What is whitespace?
A: A set of non-printing characters that create space in your source files, including tabs, spaces, and newlines.
Q. What are literals?
A: Elements that represent explicit values. "Game Over!" is a string literal, while '32' and '98.6' are numeric literals.
Q: Why should I always try to initialize a new variable with a value?
A: Because the contents of an uninitialized variable could be any value-even one that doesn't make sense for your program.
Q: Why do programmers sometimes use variable names such as 'myInt' or 'myFloat'?
A: To clearly spell out a variable's type. This convention is used frequently in programming instruction.
Q: What are variables of type 'bool' for?
A: They can represent a condition that is true or false, such as whether a chest is locked or a playing card is face up.
Q: How did the 'bool' type get its name?
A: The type is named in honor of the English mathematician George Boole.
Q: Must the names of constants be in uppercase letters?
A: No. Using uppercase is just an accepted practice — but one you should use because it's what other programmers expect.
Q: How can I store more than one character with a single variable?
A: With a 'string' object.
- How does having a widely adopted C++ standard help game programmers?
- What are the advantages and disadvantages of employing the 'using' directive?
- Why might you define a new name for an existing type?
- Why are there two versions of the increment operator? What's the difference between them?
- How can you use constants to improve your code?