You are more than welcome ivo93
A tip from me would be to clearly state why you are not happy with your code.
A suggestion for your code would be to have an outer if that asks the user if he wants to input values.This will get you into the default values concept that you will probably meet in the future with C++.
Comment : Yes , again the user has to input at least once, but you will save him time if he wants no to input.Instead of three inputs he gives one.Notice that with more variables, if he didn't want to input, then again he had to input only once. This can be very helpful in programs with trees or matrices that ask the user if he wants to input something.If not , default values are preserved.
using namespace std;
/* Initiate the variables(default values) */
int a = 56;
int b = 2;
int c = 0;
/* Inform the user what he should do */
cout<<"Would you like to input? Press Y for yes and N for no"<<endl;
/* Read what he wants to do */
/* Yes , he wants to input, so let him do it */
if(answer == 'Y')
cin >> a;
cin >> b;
cin >> c;
/* No , he doesn't want to input.Thus default values will be left */
cout<<endl<<"Default values will be printed."<<endl<<endl;;
// Print the values of the variables
cout<<"a = "<<a<<" b = "<<b<<" c = "<<c<<endl;
Question : What will happen if we do not give default values to our variables and let the user decide if he wants to input or not.If he wants, then everything ok, if not, what are the values of our variables?
In this case they will be automatically initiated to zero.But it is a good style of coding to clearly state what the values of your variables are.It also helps readability