Can't find the problem.

Apr 29, 2011 at 2:05am
I just started a wekk ago and thought of making a something small to see what i knew. So i ccreated this and thought it would work but as soon as soon as i input the value for b it ends the program. Can't figure out what is wrong.

#include <iostream>
using namespace std;
int main () {
int a;
int b;

cout << "Finding Someone's Age. \n";
cout << "Enter the fisrt number of you age:";
cin >> a;
a = a * 5;
a = a + 3;
a = a * 2;
cout << "Enter the second number of your age:";
cin >> b;
a = a + b;
a = a - 6;
cout << "Is this your age:"<< a;

return 0;
system ("pause");
}
Apr 29, 2011 at 2:07am
You are returning from main(), ending the program before the system("pause") is run, so the console closes before you can see the output.
Apr 29, 2011 at 2:09am
Thanks that helped.
Topic archived. No new replies allowed.