C++ Classes

The main difference between c and c++ programs is that c++ adds object orientation to the c programs. The classes are the central concept of object-oriented programming. Classes are an expanded concept of data structures which can contain data members and member functions and also called user-defined types.

Defining C++ Classes

A class defines a blueprint for a data type which means it does not actually define any data but defines that what the object of the class will consist of and the operations which can be performed on the object.
class keyword is used to define a class in c++.

class className {


} objects;

The body of the class can contain members which can be data members, functions or access specifiers.

C++ Access Specifiers

The access specifiers modify the access rights for the members of that class. C++ has following access specifiers.

The private Access Specifier

private members of a class can only be accessed from within members of the same class.

The protected Access Specifier

protected members of a class can only be accessed from within members of the same class and also from members of their derived classes.

The public Access Specifier

public members of a class can be accessed from anywhere where the object is visible.

Defining Class Objects

The declaration of the objects are exactly the same as of the declaration of variables of basic types.

className obj1;
className obj2;

C++ Class Example

#include <iostream>

using namespace std;

class Vehicle {
int model;
double mileage;
string make;

int main( ) {
Vehicle car1;
Vehicle car2;

car1.model = 2017;
car1.mileage= 45671;
car1.make = “Honda”;

car2.model = 2015;
car2.mileage= 91175;
car2.make = “Audi”;

cout << “Car 1 is ” << car1.make << ” ” << car1.model << ” with ” << car1.mileage<< ” mileage” <<endl;

cout << “Car 2 is ” << car2.make << ” ” << car2.model << ” with ” << car2.mileage<< ” mileage” <<endl;

return 0;

The Output will be

Car 1 is Honda 2017 with 45671 mileage
Car 2 is Audi 2015 with 91175 mileage

What is jQuery

jQuery is a fast and lightweight JavaScript library developed in 2006 by John Resig with the concept of “Write less, do more”. It makes the things like HTML document traversal, animations, event handling, AJAX interactions much simpler that works seamlessly across all the major browsers. jQuery is a very popular JavaScript library and companies like Google, Microsoft and IBM are using it in their applications.

jQuery Core Features

jQuery is designed to simplify various tasks by writing less code. Here are some core features of jQuery.

DOM manipulation

It is easy to select, traverse and modifying the contents of DOM elements through jQuery.

Event handling

The jQuery offers an elegant way to capture a wide variety of events such as click, change, blur etc.

AJAX Support

The jQuery has made it simple to develop a responsive and feature-rich site using AJAX technology.


You can use plenty of jQuery’s built-in animation effects in your websites.


The jQuery is very lightweight library and will not hurt the performance of your applications.

Compatible with browsers

The jQuery has cross-browser support, and compatible with all major modern browsers such as Mozilla Firefox, Google Chrome, Safari, Internet Explorer, and Opera.

Latest Technology

The jQuery supports the latest technologies like CSS3 selectors and basic XPath syntax.

How to use jQuery

You can use jQuery in HTML code in following ways.

jQuery Local Installation

Download jQuery library from jQuery official site (https://jquery.com/download/) on your machine and include it’s path in your HTML code.



<title>jQuery Local Installation</title>
<script type = “text/javascript” src = “/js/jquery-2.1.3.min.js”></script>
<script type = “text/javascript”>


document.write(“jQuery installed locally”);






jQuery CDN Based Installation

The jQuery library can be included into HTML code directly from CDN.



<title>jQuery CDN Based Installation</title>
<script type = “text/javascript”
src = “https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js”></script>

<script type = “text/javascript”>


document.write(“jQuery Installed from CDN”);






Introduction to C Language

C was developed by Dennis Ritchie at Bell Laboratories in 1972. Most of its principles and ideas were taken from the earlier language B, BCPL and CPL. CPL was developed jointly between the Mathematical Laboratory at the University of Cambridge and the University of London Computer Unit in 1960s. CPL (Combined Programming Language) was developed with the purpose of creating a language that was capable of both machine independent programming and would allow the programmer to control the behavior of individual bits of information. But the CPL was too large for use in many applications.

Basic Combined Programming Language

In 1967, BCPL (Basic Combined Programming Language) was created as a scaled down version of CPL while still retaining its basic features. This process was continued by Ken Thompson. He made B Language during working at Bell Labs. B Language was a scaled down version of BCPL. B Language was written for the systems programming. In 1972, a co-worker of Ken Thompson, Dennis Ritchie developed C Language by taking some of the generality found in BCPL to the B language.

Unix Kernel Development

The original PDP-11 version of the Unix system was developed in assembly language. In 1973, C language had become powerful enough that most of the Unix kernel was rewritten in C. This was one of the first operating system kernels implemented in a language other than assembly.

System Programming Language

During the rest of the 1970’s, C spread throughout many colleges and universities because of its close ties to UNIX and the availability of C compilers. Soon, many different organizations began using their own versions of C Language. This was causing great compatibility problems. In 1983, the American National Standards Institute (ANSI) formed a committee to establish a standard definition of C Language. That is known as ANSI Standard C. Today C is the most widely used System Programming Language.

First C Program, Hello World

Following C program will simply print “Hello World” on screen. Write carefully because C language is a case sensitive language.

#include < stdio.h>
void main()


printf(“Hello World\n”);


Press ALT+F9 to compile your program. If you have any error in your program, you will get the message, remove your errors and then execute your program you will got the out put.

Hello World

The printf()

The printf() function prints output to stdout, according to format and other arguments passed to printf(). The string format consists of two types of items – characters that will be printed to the screen, and format commands that define how the other arguments to printf() are displayed.

printf( “Hello World”);

The scanf()

The scanf() function reads input from stdio, according to the given format, and stores the data in the other arguments. It works a lot like printf(). The format string consists of control characters, white-space characters, and non-white-space characters.

void main(void)

int i;


C Variables & Constants

C Constants

The alphabets, numbers and special symbols when properly combined form constants, variables and keywords. A constant is an entity that does not change.

C Variables

Variables in c are names which refers to a location in memory which is used to holds some value with which we are working. A variable is an entity that may change its value. In any program we typically do lots of calculations. The results of these calculations are stored in computer memory locations. To make the retrieval and usage of these values we give names to the memory locations. These names are called variables.

C Keywords

A keyword is a word that is part of C Language itself. These words have predefined meanings and these words cannot be used as variable names.

char signed break for
auto const sizeof case
if extern double struct
continue goto register enum
typedef default return static
float union do switch
volatile int unsigned else
while long void short

Types of Variables

There are two main types of variables in C: numeric variables that hold only numbers or values, and string variables that hold text, from one to several characters long.

Basic fundamental data types in C language

char Character or small integer. 1byte signed: -128 to 127
unsigned: 0 to 255
short int Short Integer. 2bytes signed: -32768 to 32767
unsigned: 0 to 65535
long int (long) Long integer. 4bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
bool Boolean value. It can take one of two values: true or false. 1byte true or false
float Floating point number. 4bytes +/- 3.4e +/- 38 (~7 digits)
double Double precision floating point number. 8bytes +/- 1.7e +/- 308 (~15 digits)
long double Long double precision floating point number. 8bytes +/- 1.7e +/- 308 (~15 digits)