C/C++

Object-Oriented Programming In C++: Objects Composition

Submitted by PhoeniciansSy on
In real-life, complex objects are often built from smaller, simpler objects. You are built from smaller parts: a head, a body, some legs, arms, etc ... This process of building complex objects from simpler ones is called object composition. Composition is used for objects that have/has a relationship to each other. A house has a door, has a roof, has a balcony. C++ allows us to do object composition in a very simple way by using classes as member variables in other classes.

Learning More About Functions

Submitted by Muzammil Muneer on

Learning More about Functions

In this part you will learn: 1. C syntax 2. Functions 3. Function Calling 4. Function definition 5. Function prototype 6. Recursive Functions 7. Showing output

What is Recursion?

Recursion is a process of repeating of items in a self-similar way. A recursive function is a function that calls itself and this technique is known as recursion in C programming.

Introduction to Functions

Submitted by Muzammil Muneer on

Introduction to Functions

In this part you will learn: 1. C syntax 2. Functions 3. Function Calling 4. Function definition 5. Function prototype 6. Showing output

What is a Function?

In C, a function is a group of statements that together performs a task. Every C program has at least one function called the ‘main()’ function. It is the heart of the program. Functions divide your code into separate small parts so that the code is easier to understand and easier to write. Each function performs a specific task based on its usage.

Introduction to 2 Dimensional Arrays

Submitted by Muzammil Muneer on

2 Dimensional Arrays

In this part you will learn: 1. C syntax 2. 2D arrays 3. Nested for loops 4. Showing output In this tutorial I will teach you about 2D arrays. 2D arrays can be called array of arrays. First we had a single array that was in just one single dimension and we accessed its elements by writing the index in the subscript. In 2d arrays we have arrays that go in both direction.

Introduction to Arrays

Submitted by Muzammil Muneer on

Introduction to Arrays

In this part you will learn: 1. C syntax 2. Arrays 3. Showing output In this tutorial I will teach you about Arrays. Arrays are of extreme importance and use in C. Arrays are used when you want to create many variables of the same data type. Like if you want to note the grades of 100 students in a class you cannot take hundred character variables. It will be very lengthy and a not very good code. For this thing we use array. What we do is we just create an array of 100 spaces of character type.

Do While Loops

Submitted by Muzammil Muneer on

Do While loops

In this part you will learn: 1. C syntax 2. Do While loops In this tutorial I will teach you about Do While loops. We will see a very basic program at first to grasp the concept of while loop and then afterwards we will make another program of reversing a number. Do While Loop Basic Step: Open Dev C++ then File > new > source file and start writing the code below.

While Loops

Submitted by Muzammil Muneer on

While loops

In this part you will learn: 1. C syntax 2. While loops 3. More about Conditional Statements In this tutorial I will teach you about While loops. We will see two programs that use while loops. The first one will calculate the table of the number that user enters and the second one will calculate the average of a sum of numbers. Calculating Table Basic Step: Open Dev C++ then File > new > source file and start writing the code below.

Learning Nested Loops

Submitted by Muzammil Muneer on

Learning Nested loops

In this part you will learn: 1. C syntax 2. Nested Loops 3. More on For loops In this tutorial I will teach you about Nested For loops. We see some more examples of for loop in this tutorial. Printing Triangle with stars Basic Step: Open Dev C++ then File > new > source file and start writing the code below.

Switch Statement and Loops

Submitted by Muzammil Muneer on

Switch Statements and Loops

In this part you will learn: 1. C syntax 2. Switch Statement 3. For Loop In this tutorial I will teach you about Switch statements and some basics of For loop. The first program is related to switch statement. The second and third program is about for loop. Switch Statement Basic Step: Open Dev C++ then File > new > source file and start writing the code below.

Conditional Statements

Submitted by Muzammil Muneer on

Conditional Statements

In this part you will learn: 1. C syntax 2. Conditional Statements 3. Operators In this tutorial I will teach you about conditional statements in C. The first program will be a basic one with a most basic conditional statement. The second one is a grade calculator. First Program. Basic Conditional Statements Basic Step: Open Dev C++ then File > new > source file and start writing the code below.