C++ Programming/Code/Variables/Examples
Tools
General
Sister projects
In other projects
// This program adds two numbers and prints their sum.#include<iostream>intmain(){inta;intb;intsum;sum=a+b;std::cout<<"The sum of "<<a<<" and "<<b<<" is "<<sum<<"\n";return0;}
// This program adds two numbers and prints their sum, variation 1#include<iostream>#include<ostream>usingnamespacestd;intmain(){inta=123,b(456),sum=a+b;cout<<"The sum of "<<a<<" and "<<b<<" is "<<sum<<endl;return0;}