Category C++

Radix Sort Algorithm with C++ Code

radix sort

Radix sort is a non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their radix. For elements with more than one significant digit, this bucketing process is repeated for each digit, while preserving the ordering of the prior step,…

C++ String Length

String Length To get the length of a string, use the length() function: Example: Tip: You might see some C++ programs that use the size() function to get the length of a string. This is just an alias of length().…

C++ Numbers and Strings

Adding Numbers and Strings C++ uses the + operator for both addition and concatenation. Numbers are added. Strings are concatenated. If you add two numbers, the result will be a number: Example: If you add two strings, the result will…

C++ String Concatenation

String Concatenation The + operator can be used between strings to add them together to make a new string. This is called concatenation: Example: In the example above, we added a space after firstName to create a space between Priyanshu…

HTML ASCII Reference

ASCII was the first character set (encoding standard) used between computers on the Internet. Both ISO-8859-1 (default in HTML 4.01) and UTF-8 (default in HTML5), are built on ASCII. The ASCII Character Set ASCII stands for the “American Standard Code…

C++ String Data Types

String Types The string type is used to store a sequence of characters (text). This is not a built-in type, but it behaves like one in its most basic usage. String values must be surrounded by double quotes: Example: To…

C++ Character Data Types

Character Types The char data type is used to store a single character. The character must be surrounded by single quotes, like ‘A’ or ‘d’: Example: Alternatively, you can use ASCII values to display certain characters: Example: Output—-> A B…

C++ Boolean Data Types

Boolean Types A boolean data type is declared with the bool keyword and can only take the values true or false. When the value is returned, true = 1 and false = 0. Example: Output—-> Boolean values are mostly used…

C++ Numeric Data Types

Numeric Types Use int when you need to store a whole number without decimals, like 35 or 1000, and float or double when you need a floating point number (with decimals), like 9.99 or 3.14515. int float double float vs.…

C++ Data Types

C++ Basic Data Types As explained in the Variables chapter, a variable in C++ must be a specified data type: Example Output—-> int: 7float: 5.77double: 9.99char: Abool: 1string: Hello Basic Data Types The data type specifies the size and type…