Write a short C++ program that will prompt the user and input three integer values (month, day, year) from the console in a "date" format that includes '/' separator characters. E.g., 8/21/2013. You program should then output the date as 3 integer values in year, month, day order separated by commas. Enter a date in mm/dd/yyyy format: 8/21/2013 year, month, day: 2013, 8, 21
Explanation / Answer
#include int main() { int d; int m; int y; std::cin >> d; // read the day if ( std::cin.get() != '/' ) // make sure there is a slash between DD and MM { std::cout > m; // read the month if ( std::cin.get() != '/' ) // make sure there is a slash between MM and YYYY { std::cout > y; // read the year std::cout