#include <iostream>
#include <string>
using namespace std;
bool isMagicDate(int month, int day, int year)
{
if (month*day == year)
return true;
else
return false;
}
int main()
{
string date;
cout << "Enter the date in the format mm/dd/yy ";
getline(cin, date);
int pos = date.find("/");
int pos1 = date.find("/", pos + 1);
string month = date.substr(0, 2);
cout << "month is " << stoi(month) << endl;
string day = date.substr(pos + 1, 2);
cout << "day is " << stoi(day) << endl;
string year = date.substr(pos1 + 1, 2);
cout << "year is " << stoi(year) << endl;
bool magic = isMagicDate(stoi(month), stoi(day), stoi(year));
if (magic == true)
cout << date << " is a magic date" << endl;
else
cout << date << " is not a magic date" << endl;
return 0;
}
month에 한 자리수만 넣을경우 1/ 가 출력될줄 알았는데 1만 출력되는 이유가 뭐야???
₩가 표시될려면 ₩₩이되야함
는 역슬래쉬가 아니네
이해못핶어 ㅠ
/ 기호도 이런지는 모르겠는데 12/11/11 으로 입력하면 12//11//11 이런형식으로 들어간다