Interview Question in Visual Studio 2008
Interview Question :: I need help in C++ returning 3 different values in one input line |
basically, i want this person to tell me the expiration date of a food product and they have to enter it in the form of mm/dd/yyyy
then i want to return to them the day they entered so the program would look like this:
Enter expiration date in the form mm/dd/yyyy: 3/19/2008
You said the expiration day was the: 19
below is what ive been trying to put into visual studio, but it wont work, im not sure how exactly to have an input in the form of mm/dd/yyyy and then be able to store the month 'm' day 'd' and year 'y' as seperate variable, could you please correct what i have entered below to how it should look?
cout << "Enter expiration date in the form mm/dd/yyyy: ";
cin >> m;
cin >> d;
cin >> y;
cout << "You said that the expiration day was the" << d << endl; |
|
|
|

Loading ...