Skip to content
  • Home
  • Android
  • Python
  • C++
  • Java
  • Technology
  • Contact
  • Books

C++ Examples

  1. Write a C++ Program to print a welcome text in a separate line.
  2. Write a Program in C++ to add two numbers.
  3. C++ program for addition of two numbers using functions.
  4. Add two numbers in C++ using class.
  5. Addition of two numbers using call by reference in C++
  6. C++ program to write a program to add two numbers using call by value.
  7. Swapping of two numbers in C++ without using third variable. 
  8. Swap two numbers in C++ using function.
  9. C++ program to swap two numbers using class.
  10. C++ program to swap two numbers using call by value.
  11. C++ program to swap two numbers using pointers.
  12. Write a program to swap private data members of two classes using friend function.
  13. write a program to add data objects of two different classes using friend function.
  14. Threading in C++.
  15. C++ thread lambda
  16. C++ thread lambda with parameter
  17. C++ thread lambda pass by reference
  18. Singleton C++ example

Write a Program in C++ to add two numbers.

#include <iostream>

using namespace std;

int main()
{
    cout<<"Add 48 and 50:\n";
    cout<<"Addition is ";
    cout<<48+50;

    return 0;
}

Output:

Add 48 and 50:
Addition is 98
Subscribe
Notify of
guest
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Copyright © 2026 Coddesire Powered by Coddesire
wpDiscuz