Hello,
I am very new to C++. I am learning the language by myself. I tried to make a program where the user inputs how old they are (in terms of years) and the program will output how old the user is, in terms of months. The problem I am encountering is that the console will ask me for my age which I put in and click enter. Nothing happens other than the text cursor moving to the line below it. However, once the text cursor is on the second line, and I retype in the years, it outputs the number of months. My question is why does the program not output the number of months, when I type in the number of years in the first line?
Here is an image of the problem:
http://i1227.photobucket.com/albums/ee428/warrior4321/entertwice.png
Here is the code :
#include <iostream>
using namespace std;
int main()
{
int years;
cout << "How old are you?";
cin.ignore();
cin >> years;
cout << years * 12;
}