I have been learning C++ programming. What you see here is all that I know how to do at this point. I look forward to learning more and I know there are better ways to accomplish a task such as calculating, or a less verbose method for displaying information.
I want to hear from more experienced developers and engineers what they would have done better for the following code.
As I am learning new techniques I will be more inclined to pick up the better, more efficient methods of accomplishing a task, however simple it may be. I have heard that it is common for beginners to harbor bad habits. It would be the greater good as you may have to work with the likes of me in the future.
#include <iostream>
using namespace std;
int main()
{
int a;
int b;
int sum;
int diff;
int prod;
int quot;
int remain;
cout << "Welcome to the Basic Calculator for integers!" << endl;
cout << "Enter two numbers to see the difference, and please: one at a time!" << endl;
cout << "First Number: ";
cout.flush();
cin >> a;
cout << "Second Number: ";
cout.flush();
cin >> b;
cout << "\n";
sum = a + b;
diff = a - b;
prod = a * b;
quot = a/b;
remain = a%b;
cout << "Basic calculations for your two numbers: \n" << "Sum: " << sum << "\n" << "Difference: " << diff << "\n" << "Product: " << prod << "\n" << "Quotient: " << quot << " with a remainder of " << remain << endl;
}
I know that my white space looks terrible and indenting is a good thing, but for ease of formatting it looks a little uglier than I would like.