• C++ Language

    Swap Two Numbers

    Swap means exchange the value of two variable. There is four different method. Using Temporary Variable Without Using Temporary Variable Using Bitwise Operator Using Multiplication And Division Using Temporary Variable #include <iostream> using namespace std; int main() { int a = 31, b = 12, temp; cout << "Before swapping " << endl; cout << "a = " << a << ", b = " << b << endl; temp = a; a = b; b = temp; cout << "\nAfter swapping" << endl; cout << "a = " << a << ", b = " << b << endl;…

  • C++ Language

    Find Quotient and Remainder

    In this program,it will take  two integers (divisor and dividend) and find the quotient and remainder. To compute quotient and remainder, both divisor and dividend should be integers. #include <iostream> using namespace std; int main() { int divisor, dividend, quotient, remainder; cout << "Enter dividend: "; cin >> dividend; cout << "Enter divisor: "; cin >> divisor; quotient = dividend / divisor; remainder = dividend % divisor; cout << "Quotient = " << quotient << endl; cout << "Remainder = " << remainder; return 0; } OutPut Enter dividend: 17 Enter divisor: 4 Quotient = 4 Remainder = 1  

  • C++ Language

    Add Two Numbers

    In this program, two integer values taken from user and then sum of this values are stored in another variavle and then print it. #include <iostream> using namespace std; int main() { int firstNo, secondNo, sumOfTwoNo; cout << "Enter two integer values: "; cin >> firstNo >> secondNo; sumOfTwoNo = firstNo + secondNo; cout << firstNo << " + " << secondNo << " = " << sumOfTwoNo; return 0; } OutPut Enter two integer values: 4 5 4 + 5 = 9  

  • C++ Language

    Printing Hello World In C++

    Learning C++ programming can be simplified into: Writing your program in a text-editor and saving it with correct extension(.CPP, .C, .CP) Compiling your program using a compiler or online IDE The “Hello World!” program is the first step towards learning any programming language and also one of the simplest program you will learn. All you have to do is display the message “Hello World!” on the screen. Then let’s get started. Here, #include<iostream> is header file that contains standard input output library functions. A namespace is a form of scope in C++ that holds its own definitions for variables, functions,..…