I'm new to C++. I want to know if there's any way to shorten this code.
#include <iostream>
using namespace std;
int a, b, result;
int main () //Addition (main function of this program)
{
cout << "Lets add numers\nEnter you first number\n";
cin >> a; //First value
cin.clear ();
cin.get ();
cout << endl;
cout << "Enter your second number\n";
cin >> b; //Second value
cin.clear ();
cin.get ();
cout << endl;
result = a + b; //Adds the values together
cout << result; //Displays the result
cout << endl;
//this will check to see if result is even or odd
if (result % 2 == 0) cout << "your result is even";
else cout << "your result is odd";
cin.clear ();
cin.get ();
return 0;
}
Also if you see something I did, and there's a better way for it, please explain to me how I could do it better.