Jul 8, 2024
code.visualstudio.com
.C/C++
and Code Runner
.hello_world.cpp
).std::cout
), using return 0
for successful execution check, new line management (std::endl
or \n
), writing comments (//
for single-line, /* ... */
for multi-line).int x;
) and assign (x = 5;
), alternatively (int x = 5;
).int
: Whole numbers (e.g., age, year, days).double
: Decimal numbers (e.g., price, GPA, temperature).char
: Single characters (e.g., grade, initial, currency symbols).bool
: True/False states (e.g., student, power, for sale).string
: Sequence of text (e.g., name, day, address).const double PI = 3.14159;
), naming conventions (uppercase).using namespace ...
practice.%
for remainder).int x = (int)3.14;
).std::cin
for character input, handling issues with spaces using std::getline
.cmath
library.if
, else if
, else
), comparison operators (> >= < <= ==).else if
for comparing one value against many cases.if-else
(condition ? expression1 : expression2;
).&&
(AND), ||
(OR), !
(NOT) for compound conditions.break
exits loop, continue
skips to next iteration).*
(dereference operator) and &
(address-of operator).new
, delete
).template <typename T>
, overridden by various types at runtime.