I am reading through a C++ book, and for one of the tutorials I must write a program that displays my Name, Social Security, and Date of Birth. Sounds easy enough, right? Well, I want a program that takes what the user inputs, and outputs those things! But, it seems to not work, and I cant figure out why its not working! It just closes right away after running through the program (or if i use cin.get() it dosent do anything!) Please help!
Code:
#include <iostream>
using namespace std;
int name;
int socialsecurity;
int dob;
int main( )
{
cout<< "What is your name?: ";
cin>> name; // Stores the answer in the variable name
cin.ignore();
cout<< "What is your social security?: "; // Will ask you for your social security
cin >> socialsecurity;
cin.ignore();
cout<< "What is your date of birth?: ";
cin.ignore();
cin >> dob;
cout<< "Your name is " << name << ", your SSN is " << socialsecurity << ", your dob is " << dob;
return 0;
}