answersLogoWhite

0


Best Answer

#include<iostream>

int main()

{

int a=40;

int b=2;

std::cout<<a<<'+'<<b<<'='<<a+b<<std::endl;

}

Output:

40+2=42

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

int first_number = 0; // first number to add

int second_number = 0; // second number to add

int sum = first_number + second_number; // addition

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to add two integers using c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a c plus plus program to compute two integers?

int x= 1; int y= 2;


How do you write a C plus plus program that displays a pyramid of Xes on the screen using a for loop?

printf ("x")


How do you write a program in C plus plus plus plus How do you write a program in C to swap two variables without using the third oneo swap two variables without using the third one?

To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;


Would you Write c plus plus program using array for Fibonacci number?

You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....


How do you write a programm in c plus plus without using function main?

I don't think its possible. Every C++ program must at least have the main function.


Write a program to read two integers and display them using C plus plus programming?

#include&lt;iostream&gt; using namespace std; int main(int argc,char *argv[]){ int num1,num2; cout &lt;&lt; "Enter the first number" &lt;&lt; endl; cin &gt;&gt; num1; cout &lt;&lt; "Enter the second number" &lt;&lt; endl; cin &gt;&gt; num2; cout &lt;&lt; "(" &lt;&lt; num1 &lt;&lt; " " &lt;&lt; num2 &lt;&lt; " )\n"; return 0; }


A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


What is the importance of functions in a c plus plus program?

Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Write a program in c plus plus to implement macro processor?

Don't write, it is already written, google for 'cpp'.


Do I need to write a program to find a substring in a given string in c plus plus?

No.


How do you write program to convert meter to kilometer in c plus plus?

Divide it by 1000.