So this is something I made out of everything I've learned sofar.
I post it here so I can get pointers on what to improve on.
Code:#include <iostream>
using namespace std;
void add(float x){
cout << "Result: " << x << endl;
};
void sub(float x){
cout << "Result: " << x << endl;
};
void mul(float x){
cout << "Result: " << x << endl;
};
void div(float x){
cout << "Result: " << x << endl;
};
int main()
{
float a;
float b;
int c;
cout << "Loke302 Simple Calculator!\n" << endl;
cout << "Enter a number: ";
cin >> a;
cout << "Enter a number: ";
cin >> b;
cout << "[1] To Add\n[2] To Subtract\n[3] To Multiply\n[4] To Divide" << endl;
cin >> c;
if (c == 1) {add(a + b);
return 0;
}
else if (c == 2) {sub(a - b);
return 0;
}
else if (c == 3) {mul(a * b);
return 0;
}
else if (c == 4) {div(a / b);
return 0;
}
else if (c >= 5) {
cout << "Option doesn't excist!" << endl;
return 1;
}
else if (c <= 0) {
cout << "Option doesn't excist!" << endl;
return 1;
}
}