These notes explain the basic concepts of C++ programming, including variables, keywords, and number systems. A variable is a container used to store data values in a program. In C++, different types of variables are used such as int, double, char, string, and bool, which store integers, floating-point numbers, characters, text, and true/false values. The notes also explain the syntax for declaring variables with simple examples to help beginners understand how data is stored and used in a program. In addition, the material introduces C++ keywords, which are reserved words that have special meanings in the language and cannot be used as variable names. Another important topic covered is the number system used in computer architecture. The notes explain the four main number systems: Binary (base 2), Octal (base 8), Decimal (base 10), and Hexadecimal (base 16), which are used to represent numbers in computers.
Download C++ Programming Basics – Variables, Keywords and Number System Notes and more Summaries Computer Science in PDF only on Docsity!
Variables are containers for storing data values. In C++, there are different types of variables (defined with different keywords), for example: ¢ int - stores integers (whole numbers), without decimals, such as 123 or -123 * double - stores floating point numbers, with decimals, such as 19.99 or -19.99 ® char - stores single characters, such as ‘a’ or 'B'. Char values are surrounded by single quotes « string - stores text, such as "Hello World". String values are surrounded by double quotes * bool - stores values with two states: true or false 1 Keywords(also known as reserved words) have special meanings to the C++ compiler and are always written or typed in short(lower) cases. * Keywords are words that the language uses for a special purpose, such as void, int, public, etc. * It can’t be used for a variable name or function name or any other identifiers. The total count of reserved keywords is 95. 32 Keywords in C++ Language which Is also available In C language. auto doupie ine struct break ene tong switcn case enum register typecer const Noat snort unsignea conunue for signea vora geraur goto sizeot votatie go « static write Another 30 reserved words that were not in C, these are new to G++ asm dynamic_cast namespace reinterpret_cast boot expen new static_cast catcn raise operator tempiate class friend private this const_cast inne pusne tnrow aetete mutapie protected te try rypeia typename using using wirtuan wenart Note: you can not use these keyword for variable and not overload TYPES OF NUMBER SYSTEM ber Syst Decimal Binary octaL Number system number system Number system numbe t wers Wit base 10 base 2 102)jo, (2 Hexadecimal Number system mpers with