I'm trying to make a basic code but i can't use "/" for an input.
everything is good but when it goes to the part to enter the date and i put a forward slash, then the program skips everything. it only works if i don't use the forward slash.
#include <iostream>
int main()
{
std::cout << "\nPlease enter the date in the format of mm/dd/yyyy: " ;
int month ;
int day ;
int year ;
char separator ;
if( std::cin >> month >> separator && separator == '/' &&
std::cin >> day >> separator && separator == '/' && std::cin >> year )
{
std::cout << "you entered " << month << '/' << day << '/' << year << '\n' ;
}
else std::cerr << "badly formed input\n" ;
// TODO: validate date
}