learncpp.com
learncpp.com
CRITIC
img-contested
N/A
0 reviews
PUBLIC
img-contested
N/A
0 reviews

RECENT ARTICLES

Sort by:
No Rating
2.6 — Why functions are useful, and how to use them effectively – Learn C++

2.6 — Why functions are useful, and how to use them effectively – Learn C++

Now that we’ve covered what functions are and some of their basic capabilities, let’s take a closer look at why they’re useful.Why use functions?New programmers often ask, “Can’t we just put all the code inside the main function?” For simple programs, you absolutely can. However, functions provide a number of benefits that make them extremely useful in programs of non-trivial length or complexity.Effectively using functionsOne of the biggest challenges new programmers encounter (besides learning the language) is understanding when and how to use functions effectively. Here are a few basic...

October 5, 2023
Share
Save
Review
No Rating
2.13 — How to design your first programs – Learn C++

2.13 — How to design your first programs – Learn C++

Now that you’ve learned some basics about programs, let’s look more closely at how to design a program.When you sit down to write a program, generally you have some kind of idea, which you’d like to write a program for. New programmers often have trouble figuring out how to convert that idea into actual code. But it turns out, you have many of the problem solving skills you need already, acquired from everyday life.The most important thing to remember (and hardest thing to do) is to design your program before you start coding. In many regards, programming is like architecture. What would...

October 5, 2023
Share
Save
Review
No Rating
3.8 — Using an integrated debugger: Watching variables – Learn C++

3.8 — Using an integrated debugger: Watching variables – Learn C++

In the previous lessons (3.6 -- Using an integrated debugger: Stepping and 3.7 -- Using an integrated debugger: Running and breakpoints), you learned how to use the debugger to watch the path of execution through your program. However, stepping through a program is only half of what makes the debugger useful. The debugger also lets you examine the value of variables as you step through your code, all without having to modify your code.As per previous lessons, our examples here will use Visual Studio -- if you are using a different IDE/debugger, the commands may have slightly different names...

October 5, 2023
Share
Save
Review
No Rating
4.5 — Unsigned integers, and why to avoid them – Learn C++

4.5 — Unsigned integers, and why to avoid them – Learn C++

Unsigned integersIn the previous lesson (4.4 -- Signed integers), we covered signed integers, which are a set of types that can hold positive and negative whole numbers, including 0.C++ also supports unsigned integers. Unsigned integers are integers that can only hold non-negative whole numbers.Defining unsigned integersTo define an unsigned integer, we use the unsigned keyword. By convention, this is placed before the type:unsigned short us;unsigned int ui;unsigned long ul;unsigned long long ull;Unsigned integer rangeA 1-byte unsigned integer has a range of 0 to 255. Compare this to the...

October 5, 2023
Share
Save
Review
No Rating
7.8 — Why (non-const) global variables are evil – Learn C++

7.8 — Why (non-const) global variables are evil – Learn C++

If you were to ask a veteran programmer for one piece of advice on good programming practices, after some thought, the most likely answer would be, “Avoid global variables!”. And with good reason: global variables are one of the most historically abused concepts in the language. Although they may seem harmless in small academic programs, they are often problematic in larger ones.New programmers are often tempted to use lots of global variables, because they are easy to work with, especially when many calls to different functions are involved (passing data through function parameters is a...

October 5, 2023
Share
Save
Review
  • Total 5 items
  • 1
AUTHORS
Alex

Alex

CRITIC
img-contested
N/A
PUBLIC
img-contested
N/A