C++ Iterative statements(cont.)

We have already seen for loops. Now let us look at while loop and the do-while loop. While loop A while loop enables you to execute a block of code if a given condition is true. It is like a repeating if statement. It checks the condition before each loop. The following code example shows how to... Continue Reading →

C++ Iterative statements

Iterative statements or repetitive statements or loops repeatedly execute a statement or multiple statements till a particular condition is met. Performing the same task repeatedly is called iteration. C++ provides us with 3 types of iterative statements namely for loop,while loop and do-while loop. You might need to iterate over a set of items in... Continue Reading →

C++ Decision making(cont.)

We have seen the use of if,if-else and if-else if-else loops for decision making.If there are too many else if statements the program becomes difficult and cumbersome. For this purpose we use the switch statement to replace multiple else if statements. The basic syntax of a switch statement is as follows: switch (a) ​{ case... Continue Reading →

C++ Decision making

Decision making requires that the programmer specifies one or more conditions to be evaluated by the program, along with: a statement or statements to be executed if the condition is determined to be true and other statements to be executed if the condition is determined to be false. The 2 main decision making statements in... Continue Reading →

C++ Operators

Operators are symbols that help us perform mathematical and logical operations on operands. Operators are used to perform operations on variables and constants.A list of C++ operators are given below. Prefix increment ++ Prefix decrement -- One's complement ~ Logical not ! Unary negation - Unary plus + Multiplication * Division / Modulus % Addition... Continue Reading →

C++ Enumerations

An enumeration is a user-defined type that consists of a set of named integer constants that are known as enumerators. Enum is a user defined data type where we specify a set of values for a variable and the variable can only take one out of a small set of possible values. We use enum keyword to... Continue Reading →

C++ Structures

We have gone through arrays in the previous blog. Let us recall the important points about an array. An array holds multiple values of the same data type in one variable. So the values must be of the same data type. What if you have values of different data types? What if you want to... Continue Reading →

C++ Strings

Strings are a set of characters.A string is also an array of characters. The last character of every string is a null character that is represented by the ASCII code for 0 which is \0.('\0').This is for the compiler to know where the string ends. C++ does not regard a character array that does not... Continue Reading →

Powered by WordPress.com.

Up ↑