Find the best tutors and institutes for C++ Language

Find Best C++ Language classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

C++ Language Updates

Ask a Question

Post a Lesson

All

All

Lessons

Discussion

Lesson Posted on 24 Jul IT Courses/Programming Languages IT Courses/Programming Languages/C++ Language/Advanced C++

C, C++, JAVA Tutor

Sumit Singh

I'm a proficient tutor in many programming languages C, C++, Java naming a few. I've been teaching 11th...

* Program to swap two numbers using a temporary variable with each statement explained with comments * #include // headerfile for cout statement using namespace std; // include standard library files int main() // main()- starting point of the... read more

* Program to swap two numbers using a temporary variable with each statement explained with comments *

 

#include                // headerfile for cout statement
using namespace std;              // include standard library files

int main()                        // main()- starting point of the program with int return type  
{                                 //  start of main()
    int a = 5, b = 10, temp;      // 3 variables where a,b are initialised and a temp variable 

    cout << "Before swapping." << endl;               // print statement
    cout << "a = " << a << ", b = " << b << endl;     // values before swapping

    temp = a;                     // assign a to temp
    a = b;                        // assign b to a
    b = temp;                     // final step in  swapping with assigning temp ,ie, a to b

    cout << "\nAfter swapping." << endl;              // print statement
    cout << "a = " << a << ", b = " << b << endl;     // values after swapping

    return 0;                     //return value required coz on int return type of main()
}                                 // termination of main()

// Semi-colon ';' is termination of each valid C++ statement

 

read less
Comments
Dislike Bookmark

Answered on 22 Aug IT Courses/Programming Languages/C++ Language/Advanced C++ IT Courses/Programming Languages/C Language

Siva Naga

IT Professional Trainer

Switch is especially useful as check point for multiple conditions. Syntax: Switch(condition) { case 1: logic ;break; case 2 :logic; break; default : logic; } .switch statement checks condtion or choice and look for right case and execute the logic and then break the execution flow. if it did not... read more

Switch is especially useful as check point for multiple conditions.  Syntax: Switch(condition) {  case 1: logic ;break; case 2 :logic; break; default : logic; } .switch statement checks condtion or choice  and look for right case and execute the logic and then break the execution flow. if it did not find the any matched case , it will execute default  block.
ex: int day=1;
switch(day){
case 1:
          print("Monday");
           break;
case 2:
          print("Tuesday");
           break;
case 1:
          print("Wednesday");
           break;
case 1:
          print("Thursday");
           break;
case 1:
          print("Friday");
           break;
case 1:
          print("saturday");
           break;
Default:
          Print("Sunday");
}

read less
Answers 4 Comments
Dislike Bookmark

Looking for C++ Language classes

Find best C++ Language classes in your locality on UrbanPro.

FIND NOW

Lesson Posted on 05 Jul IT Courses/Programming Languages/C++ Language

Compare C And C++ In Terms Of Header Files.

Suprio D.

Having training experience in dot-net Platform(3.5 LinQ,and wcf framework,webservices,MVC 4).. Applications),trained...

1."stdio.h" in c program controls input-output functionalities and operations associated with it where as in c++ program iostream.h" controls input-output functionalities and operations associated with it. 2."stdlib.h" in c program controls memory management like calloc ,malloc. where as "conio.h" in... read more

1."stdio.h" in c program controls input-output functionalities and operations associated with it where as in c++ program iostream.h" controls input-output functionalities and operations associated with it.

2."stdlib.h" in c program controls memory management like calloc ,malloc. where as "conio.h" in c++ program controls memory management like new and delete etc.

read less
Comments
Dislike Bookmark

Lesson Posted on 02 Jul IT Courses/Programming Languages/C++ Language/Advanced C++

How are C And C++ Different Form Each Other

Suprio D.

Having training experience in dot-net Platform(3.5 LinQ,and wcf framework,webservices,MVC 4).. Applications),trained...

1.C and C++ both have data types operator and conditional looping control statements. But the difference is that C++ has to object-oriented concepts which C programs do not have. Hence C program is like the subset of C++ program. 2. Hence C is a procedural programming language, and C++ is object-oriented... read more

1.C and C++ both have data types operator and conditional looping control statements.

But the difference is that C++ has to object-oriented concepts which C programs do not have. Hence C program is like the subset of C++ program.

2. Hence C is a procedural programming language, and C++ is object-oriented programing language.

2.C does not support functions, function overloading and operator overloading whereas C++ programs do.

3.C++ supports virtual and friend functions, whereas C has no support for virtual and friend functions.

4.C provides malloc() and calloc()functions for dynamic memory allocation, and free() for memory de-allocation, whereas C++ offers a new operator for memory allocation and delete operator for memory de-allocation.

5.C does not provide direct support for error handling (also called exception handling), C++ provides support for exception handling. Exceptions are used for "hard" errors that make the code incorrect.

6.C uses functions for input/output. For example, scanf and printf, whereas C++ uses objects for input-output. For example cin and cout.

7.C does not allow functions to be defined inside structures, whereas in C++, functions can be used inside a structure.

8.C does not support object-oriented programming; therefore it has no support for polymorphism, encapsulation, and inheritance, whereas, C++, being an object-oriented programming language, supports polymorphism, encapsulation, and inheritance.

read less
Comments
Dislike Bookmark

Answered on 30 May IT Courses/Programming Languages/C++ Language/Basic C++

I preferred NCERT & R.d Sharma for Mathematics.I preferred S. Chand for Science & Follow the... read more

I preferred NCERT & R.d Sharma for Mathematics.
I preferred S. Chand for Science & Follow the NCERT question from NCERT.

read less

N. K Mishra

Tutor

Yes I can do this.
Answers 1 Comments 1
Dislike Bookmark

Looking for C++ Language classes

Find best C++ Language classes in your locality on UrbanPro.

FIND NOW

Lesson Posted on 17 Apr Tuition/BCA Tuition/Programming in C++ IT Courses/Programming Languages/C++ Language/Basic C++ Tuition/BSc Tuition/BSc Computer Science

Swapping Two Numbers

Pooja R.

I am a Computer Science BS, MS and PhD. I have taught in various classes, different subjects in Computer...

Q. Swap two numbers using the following function. Complete the function. You won't be allowed to use a temporary variable to swap the two numbers. void swap ( ... ) { /* Swap code goes here */ } int main () { int a = {2,3}; /* print the array so that a is 3 and a is 2 */ /* swap... read more

Q. Swap two numbers using the following function. Complete the function. You won't be allowed to use a temporary variable to swap the two numbers.

 

void swap ( ... )

{

  /* Swap code goes here */

}

 

int main ()

{

  int a[2] = {2,3};

  /* print the array so that a[0] is 3 and a[1] is 2 */

  /* swap function call and print code goes here */

}

read less
Comments
Dislike Bookmark

Lesson Posted on 10 Mar IT Courses/Programming Languages/C++ Language

Contents Of C++ Programming

Vilas Dongre

I have 16 years of experience in IT training with C , CPP, C#, ASP.NET. Also taken batches at various colleges.

1. History of CPP 2. Concepts of OOP's 3. Introduction and Features of CPP (OOP's) 4. Characteristics of OOP's 5. CPP Keywords 6. Major Components of CPP: Encapsulation Inheritance Polymorphism 7. Limitations 8. Programs: Default Arguments Inline Function Function... read more
1. History of CPP
 
2. Concepts of OOP's
 
3. Introduction and Features of CPP (OOP's)
 
4. Characteristics of OOP's
 
5. CPP Keywords
 
6. Major Components of CPP:
  • Encapsulation
  • Inheritance
  • Polymorphism
7. Limitations
 
8. Programs:
  • Default Arguments
  • Inline Function
  • Function Overloading
  • Scope Resolution Operator
9. Reference Variable
 
10. Class:
  • Instance
  • Constructor
  • Copy Constructor
  • Distructor
11. Static Data Member
 
12. Static Member Function
 
13. Friend Function
 
14. Encapsulation
 
15. Inheritance:
  • Single Inheritance
  • Types of Visibility Labels
  • Effect of Visibility Labels
  • Multiple Inheritance
  • Multilevel Inheritance
  • Multipath Inheritance
  • Hybrid Inheriance
16. Polymorphism:
  • Runtime Polymorphism
  • Function Overloading
  • Operator Overloading
17. Compile Time:
  • Polymorphism
  • Virtual Function
  • Pure Virtual Function
18. Dynamic Memory Allocation
 
19. Templates
 
20. Generic Functions
 
21.File Handling
read less
Comments
Dislike Bookmark

Lesson Posted on 05 Mar Tuition/BA Tuition/C++ Programming IT Courses/Programming Languages/C++ Language

C++ Overview

Namrata

Introduction: C++ is the first object oriented programming language used universally as an advanced version of C language. Many features such as Inheritance, Class & Object, Polymorphism(Function overloading) etc are introduced in C++ which are not available in C Language. There are many differences... read more

Introduction:

C++ is the first object oriented programming language used universally as an advanced version of C language. Many features such as Inheritance, Class & Object, Polymorphism(Function overloading) etc are introduced in C++ which are not available in C Language.

There are many differences between C & C++ few are mentioned below:

Difference between C & C++:

C

C++

C supports procedural programming paradigm for code developmen

C++ supports both procedural and object oriented programming paradigms; therefore C++ is also called a hybrid language.

Follows top-down approach.

Follows bottom up approach.

C is a subset of C++. It cannot run C++ code.

C++ is a superset of C. C++ can run most of C code while C cannot run C++ code.

Function-driven language

Object-driven language

Low-level language

Middle-level language

C requires one to declare all the variables at the top of the program.

In C++, the variables can be declared anywhere in the program before use.

The default header file used in C language is stdio.h

The default header file used in C++ is iosteam.h

The features which are supported in C++ and not available in C Language:

Functions inside Structure:

In case of C++, functions can be used inside a structure while structures cannot contain functions in C.

Classes and Objects:

Class is a user defined datatype which contains member variables and member functions.

Object is a instance of defined class which helps to access member variable and member functions of the class.

We can define as many objects as we can for one class.

Function Overloading:

Function overloading is also known as a Polymorphism. Function overloading enables programmer to use same function name for multiple time(with different definition) through out the program.

Inheritance:

Inheritance is the capability of one class to acquire properties and characteristics from another class. The class whose properties are inherited by other class is called the Parent or Base or Super class. And, the class which inherits properties of other class is called Child or Derived or Sub class.

Constructor and Destructor:

A class constructor is a special member function of a class that is executed whenever we create new objects of that class. Constructor has the same name as class name. 

A destructor is a special member function of a class that is executed whenever an object of it's class goes out of scope or whenever the delete expression is applied to a pointer to the object of that class. Destructor also has the same name as class name but only declared with tilde sign (~) before the declaration.

C++ has  many other features such as namespace, exception handling, reference variable etc. More detailed information will be covered in upcoming articles.

read less
Comments
Dislike Bookmark

Looking for C++ Language classes

Find best C++ Language classes in your locality on UrbanPro.

FIND NOW

Lesson Posted on 07 Feb IT Courses/Programming Languages/C++ Language

Polymorphism In C++

Ajit Deshmukh

Currently working with CRB Tech Solutions pvt ltd as a Trainer for C, C++ Data Structure and Core Java. Worked...

Basically polymorphism represents poly means many and morph means forms that many forms. In which we are passing same message to different objets but every object will work for that message in their own manner. Means message is same but implementaion is different. Take an real life example: Suppose... read more

Basically polymorphism represents poly means many and morph means forms that many forms.

In which we are passing same message to different objets but every object will work for that message in their own manner. Means message is same but implementaion is different.

Take an real life example:

Suppose I have set of 50 LED TV's. There are two cases.

Case 1: Each tv has seperate remote but it is very difficult for me to manage each tve remote.

Case 2: I can use common remote to manage all LED Tv's. So it is very esay for me to manage all tv's with the help of common remote.

So second case represents polymorphism concept. We are providing common message but its implementaion is different.

Before going to polymorphism we will understand what is mean by binding.Binding represents association of object with function. There are two types of binding:

1. Compile time binding (Early binding or static binding): At compile time, binding takes place that will be representd as compilr time binding.

2. Run time binding (Late binding or dynamic binding): At run time,  binding takes place that will be represented as run time biding.

So we have to understood the concept of run time binding before that we need to understand two concepts.

1. Function overloading: Same function name but different signature represents function overloading. It will always takes place into same classes. Signature means may be no of parameters,sequence and its return type may be different.

2. Function overriding: All things of function(Function name,signature, return type) are same then it will be represented as function overriding. But function overriding always takes place in to different classes.

For example:

class A

{

       public:

                void show()

                {

                         cout<<"In class A"<<endl;

                 }

};

 

Class B : public A

{

                void show()

                {

                          cout<<"In class B";

                }

}

 

So In above example void show() function represents Function overrding concept. Function overriding always takes place into different classes when we are using inheritance concept.

Now let's see polymorphism concept:

For example:

class A

{

       public:

                void show()

                {

                         cout<<"In class A"<<endl;

                 }

};

 

class B: public A

{

                void show()

                {

                          cout<<"In class B";

                }

}

 

 

void main()

{

          A  *p;                   //base class pointer

          B  bObj;              //object of derived class

          p = &bObj;         //assigned address of class B object to base class pointer p.

          p->show();        //Trying to call derived class function withe the help of base class pointer.

}

 

In above example I am trying to call function of dereived class B. But here compile time binding takes place. Here compiler calls base class function because the compilre will check type of pointer. So we have declared pointer is type of Class A. Here compilre is not going to consider what address stored within pointer. It will just consider what type of pointer we have created and it will call base class function.

So how to resolve this problem. So for that we need to apply run time polymeophsim. In C++ run time polymeorphism is achieved by using virtual keyword. Here we have to just make base class function as  virtual. No need to use virtual keyword for each overrided function. Need to make base class function as virtual. Here all ovrrided function automatically made virtual because we using inheritance concept.

If we are using function overriding then and then your derived classes functins become virtual.

So just consider following change in above same example.We are just making void show() function of base class A as a virtual.

For example:

class A

{

       public:

                virtual  void show()

                {

                         cout<<"In class A"<<endl;

                 }

};

 

class B : public A

{

                void show()

                {

                          cout<<"In class B";

                }

}

void main()

{

          A  *p;                   //base class pointer

          B  bObj;              //object of derived class

          p = &bObj;         //assigned address of class B object to base class pointer p.

          p->show();        //It will call appropriate function of class B.

}

 

So now we will get expected output because we have applied run time polymorphism. We have just made base class function as a virtual. Now compiler going to check at run time what type of address we have stored within this base class pointer. So it will call appropriate function of derived class.

So in this way we have achieved polymorphism with the help of virtual keyword. So we are calling here derived classes function with the help of base class pointer.

read less
Comments
Dislike Bookmark

About UrbanPro

UrbanPro.com helps you to connect with the best C++ Language classes in India. Post Your Requirement today and get connected.

Overview

Questions 92

Lessons 59

Total Shares  

+ Follow 47,011 Followers

Top Contributors

Connect with Expert Tutors & Institutes for C++ Language

x

Ask a Question

Please enter your Question

Please select a Tag

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more