Showing posts with label c tutorial for beginners. Show all posts
Showing posts with label c tutorial for beginners. Show all posts

Thursday, 17 October 2013

Do While In C++

Do While C: In this C tutorial for beginners, we are going to discuss the third repetition structure known as do…while loop in c. In for loop, initially the loop condition is checked and then the statement is executed according to the loop condition. But if you want to execute the statement initially(first) and then check the loop condition then we use do…while loop. Syntax: do       statement;while (expression); Statement...

For Loop In C++

For Loop In C++: The while loop discussed in our previous tutorial is a general form which can be implemented in a different form of repetitions. In this C tutorial for beginners, we are going to study second repetition structure known as for loop c. In C++, for loop is a specialized form of while loop. Its primary purpose is to simplify the writing of counter-controlled loops.In while loop, you had to declare a counter variable and write an extra...

While Loop In C++

While Loop In C++: In C++, there are times when it becomes necessary to repeat a set of statements several times. One way is to write the code in the program over and over but that would make the code very long and it would become a messy code. Just imagine that if you have to repeat a set of statements 100 times then you have to write that 100 times again and imagine where the length of the code would go. Fortunately, we have a way that finishes...

Preprocessor Directives In C

Preprocessor directives in C: In C++, we don’t have large number of operations. Only small number of operation like arithmetic and assignment operations are available. But to run a C++ program many type of functions are required. C++ has a collection of libraries. We use them to get access to many interesting and important operations. Every library has a unique name and is referred to by a header file. Examples: The function needed to perform input/output (I/O) are contained in the header file iostream.For performing useful mathematical...

Break And Continue Statements

Break And Continue Statements: In this C tutorial for beginners, we are going to discuss a very useful facility of C++ which are break and continue statements. Break statement in C: Previously, we have seen that break statement was used in a switch structure. Similarly, you can use break statement in while, for and do…while loops. When a break statement executes in a repetition structure, it immediately exits from the repetition structure. There are times when our requirement is met but the loop still doesn’t finish so, we use this break...

Sunday, 6 October 2013

Control Structures ( if else c)

Control Structures (If else statement): If-else and else-if c are very important conditions in C++. In this c tutorial for beginners  we are going to focus on control structures of if and if…else. Control structures are really useful because they allow us to decide between different conditions.  In C++, there are two types of structures:  Control structure  switch structure. This tutorial discusses how if and if…else...

Logical Operators

 Logical Operators: C++ provides us the facility of combining logical expression and evaluate their behavior. So, in this C tutorial for beginner, we are going to discuss  logical operators in c. We are going to discuss how to form and evaluate logical expressions and see how they work. Below are three logical operators in C++ that we normally use: Operator        Description !                    not &&       ...

Relational Operators in C++

Relational Operators In C++: To make decisions in a C++ program, you must be able to compare conditions. So, in this C tutorial for beginners we’re going to discuss relational c operators. For example, if we want to see who has the highest, average and lowest marks in some class then we need to develop such algorithm which would require comparing marks of students so, we are going to need relational c operators for that. In C++, a condition is represented by a logical expression. It would be either true or false. And true and false are Boolean...

Creating A C++ Program

How to Create a C++ program?? In this C tutorial for beginners, we are going to learn how to create C++ programs with output. After studying previous tutorials, we now have the basic and required concepts needed to create a C++ program. A C++ program is a collection of function, one of which is the function main. A function is a set of instructions designed to accomplish specific task. We’ll deal with functions in further tutorials in detail. The syntax of the function main is: int main(){    Statement 1   ...

Order Of Operator Precedence In C++

 Order Of Operator Precedence In C++ C operator precedence is the most important thing in calculating  arithmetic, relational and logical operations. So, now we need to discuss the order of operator precedence in C when all these operators come in a single expression. In this C tutorial for beginners, we are going to discuss their order of precedence. For example: The expression like the ones below:  11> 1 || !9 && 5+5*2 && 6%8   2 > ‘A’ && 7*4 !true + (2 % 5 * 3 – 1 + 5) How we are...

Saturday, 5 October 2013

Cout in C++

Cout in C++: In previous tutorial, we learnt how to store data. Now we will learn in this C++ tutorial that how to print that desired result on the console. In C++, output on the standard output device is accomplished through the use of "cout" and the operator “ << ”. Note:  The standard output device is usually the screen. Syntax: cout << expression or identifier ; This is called an output statement. In C++, "<<" is called the stream insertion operator. Example:  Here are some simple c programs with...

Indentation in C++

v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Indentation In C++: Normal 0 false false false false EN-US X-NONE X-NONE ...