Category: C++ Language
Constants in C++ Language: (1) In C++ Language, Constants means read-only variables. (2) Syntax of CONSTANT variable: const double myDouble = 10.5; (3) Example as shown: (4) As per the above image, the system shows an error while “Build” the written code for execution because in Constant variable case, you cannot assign another value. Continue Statement …
Identifiers in C++ Language: (1) In C++ Language, Identifiers are nothing but variables. It is recommended to define variable names as unique and more descriptive. Like int myInt → myInt is Identifier double myDouble → myDouble is Identifier char myChar → myChar is Identifier. stringmyString → myString is Identifier bool myBool → myBool is identifier (2) …
Declare and Assign Values to Variables in C++: (1) In this blog, we will see how to declare and assign values to variables. int myInt = 10; double myDouble = 10.5; char myChar = ‘A’; string myString = “My first String”; bool myBool = True; (2) Sample C++ language code and its output, as shown: #include …
Types of Variables in C++ Language: (1) In C++ Language, values are stored in variables. There are different types of variables. int: It stores the whole number w/o decimal, eg.: 1, 2, 123, 345. double: It stores whole and decimal numbers, eg.: 1, 2.5, 123.45, 345. char: It stores a single keyword, eg.: A, B, C. …
Use of endl in C++ Language: (1) “<< endl” is an alternate of “\n” for inserting a new line or print output in the next line. (2) Sample C++ language code and its output, as shown: #include <iostream>using namespace std;int main() {cout<< “My first C++ Language Line!” <<endl;cout<< “My second C++ Language Line!”;return 0;} (3) After …
Insert a New Line in C++: (1) “\n” is used for inserting a new line or print output in the next line. (2) Sample C++ language code and its output, as shown: #include <iostream>using namespace std; int main() { cout << “My first C++ Language Line!\n”; cout << “My second C++ Language Line!\n”; return 0;} (3) After …
cout in C++ Language: (1) “cout<<” is used for printing output value or text. (2) Sample C++ language code and its output, as shown: #include <iostream>using namespace std;int main() {cout << “My first C++ Language code!”;return 0;} (3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown. …
C++ Language Syntax: (1) C++ Language is designed by “Bjarne Stroustrup”. (2) C++ Language is an object-oriented programming language. (3) C++ Language gives a high level of control over system resources and memory. (4) C++ Language is used in Operating systems, embedded systems etc. (5) For learning C++ Language, first install the editor and compiler. For …