add two numbers in c++
C++
#include<iostream>
using namespace std;
int main()
{
double number1,number2;
double sum0;
sum=number1+number2;
cout<<sum;
}#include <iostream>
using namespace std;
//function declaration
int addition(int a,int b);
int main()
{
int a,b; //to store numbers
int add; //to store addition
//read numbers
cout<<"Enter first number: ";
cin>>a;
cout<<"Enter second number: ";
cin>>b;
//call function
add=addition(a,b);
//print addition
cout<<"Addition is: "<<add<<endl;
return 0;
}
//function definition
int addition(int a,int b)
{
return (a+b);
}
Also in C++:
- Title
- Qt asynchronous HTTP request
- Category
- C++
- Title
- length of string c++
- Category
- C++
- Title
- capitalize first letter c++
- Category
- C++
- Title
- pass vector by reference c++
- Category
- C++
- Title
- how to get the largest number in a c++ array
- Category
- C++
- Title
- free or delete in c++
- Category
- C++
- Title
- Html tab
- Category
- C++
- Title
- how to find the number of cycles in a graph C++
- Category
- C++
- Title
- array search c++
- Category
- C++
- Title
- hashset in c++
- Category
- C++
- Title
- cpp pi from acos
- Category
- C++
- Title
- c++ ternary operator
- Category
- C++
- Title
- how read a shader from another file c++
- Category
- C++
- Title
- c++ remove text file
- Category
- C++
- Title
- how to round to nearest whole number unity
- Category
- C++
- Title
- max in c++
- Category
- C++
- Title
- pionter in c++
- Category
- C++
- Title
- how to decalre a string in c++
- Category
- C++
- Title
- iterate const vector
- Category
- C++
- Title
- c++ uint32_t
- Category
- C++
- Title
- convert decimal to binary in c++
- Category
- C++
- Title
- c++ switch case statement
- Category
- C++
- Title
- phph date
- Category
- C++
- Title
- double to string c++
- Category
- C++
- Title
- first prime numbers
- Category
- C++
- Title
- Find a element in a map C++
- Category
- C++
- Title
- remove value from vector c++
- Category
- C++
- Title
- getch c++ library
- Category
- C++
- Title
- c++ char print width
- Category
- C++
- Title
- cpp how to create an object of template class
- Category
- C++
- Title
- how print fload wiht 3 decimal in c++
- Category
- C++
- Title
- arduino delay millis
- Category
- C++
- Title
- what is difffrence between s.length() and s.size()
- Category
- C++
- Title
- create new file c++
- Category
- C++
- Title
- how to compare lower case character to uppercase cpp
- Category
- C++
- Title
- unordered_map c++ insert
- Category
- C++
- Title
- substitution failure is not an error
- Category
- C++
- Title
- c++ parse int
- Category
- C++
- Title
- c++ lettura file
- Category
- C++
- Title
- c++ initialization list
- Category
- C++
- Title
- c++ for loop
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- how to check datatype of a variable in c++
- Category
- C++
- Title
- hobo 8
- Category
- C++
- Title
- c++ pointers
- Category
- C++
- Title
- how to cout in c++
- Category
- C++
- Title
- c++ iterate through constant list
- Category
- C++
- Title
- programa para saber si un numero es primo
- Category
- C++
- Title
- recursion in cpp with reference
- Category
- C++
- Title
- how to find the mode of a vector c++
- Category
- C++
- Title
- c++ show time elapsed
- Category
- C++
- Title
- inconsequential meaning
- Category
- C++
- Title
- euler phi gfg
- Category
- C++
- Title
- converting char to int in c++
- Category
- C++
- Title
- assegnare valori in c++
- Category
- C++
- Title
- how to have a queue as a parameter in c++
- Category
- C++
- Title
- passing array to function c++ pointer
- Category
- C++
- Title
- coronavirus
- Category
- C++
- Title
- c++ code to print hello world
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- c++ scanf
- Category
- C++
- Title
- variabvles in c++
- Category
- C++
- Title
- hashmap in c++
- Category
- C++
- Title
- c++ compiler for sublime text
- Category
- C++
- Title
- how to get input from the console in c++
- Category
- C++
- Title
- initialize map c++
- Category
- C++
- Title
- sum of integer in array c++
- Category
- C++
- Title
- c++ convert int to cstring
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- conditional operator in cpp
- Category
- C++
- Title
- how to use max_element in c++ with vector
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- loop through array c++
- Category
- C++
- Title
- how to print eachh chars in string data type in c++
- Category
- C++
- Title
- how to make a switch case statement in c++
- Category
- C++
- Title
- c++ typedef
- Category
- C++
- Title
- for each c++
- Category
- C++
- Title
- switch c++
- Category
- C++
- Title
- how to compile opencv c++ in ubuntu
- Category
- C++
- Title
- primos menores que
- Category
- C++
- Title
- Merge k sorted linked lists and return it as one sorted list.
- Category
- C++
- Title
- pyqt connect
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- c++ cli convert string to string^
- Category
- C++
- Title
- Get handle in C++
- Category
- C++
- Title
- FInd the element which appears more than n/2 times C++
- Category
- C++
- Title
- how to print a string to console in c++
- Category
- C++
- Title
- how long can a c++ string be
- Category
- C++
- Title
- power c++
- Category
- C++
- Title
- goto c++
- Category
- C++
- Title
- preorder traversal
- Category
- C++
- Title
- inheritance protected in c++
- Category
- C++
- Title
- How to read a file in in C++
- Category
- C++
- Title
- c++ base 10 to base 2
- Category
- C++
- Title
- zeros of array c++
- Category
- C++
- Title
- c++ file to string
- Category
- C++
- Title
- unsorted array to bst
- Category
- C++
- Title
- user input c++
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- getline not working c++
- Category
- C++