+ 3
How can we add two variable in c++ programming
7 Answers
+ 2
Martin Taylor
int x = std::rand();
int y = std::rand();
if (0 >= (x += y))
x = INT_MAX;
+ 4
int a = 5;
int b = 7;
int c = a+b;
+ 4
There is a sample in this lesson: https://www.sololearn.com/learn/CPlusPlus/1607/
+ 2
#include <iostream>
using namespace std;
int main() {
int num1 = 17;
int num2 = 25;
int sum = num1 + num2; //outputs 42 (the meaning to life, the universe, and everything!)
cout << sum << endl;
return 0;
}
0
No example used inputs *cough*