I am having trouble with the portion where I need to print the day. I tried making a second variable but it is not working. Basically I take a user input for their birthday. Then I'm trying to call this function that determines the day of birth (it determines a number that represents a day). Then I am trying to send this number to the function that takes the number and prints the birthday day in words. I am now getting the error that 'int day2' redefinition.
Here is my code:
void determineDayOfBirth() {
int day;
int month;
int year;
char backslash;
char backslash2;
cout << "Enter your date of birth" << endl;
cout << "format: month / day / year -->" << endl;
cin >> month >> backslash >> day >> backslash2 >> year;
if (isValidDate(month, day, year)) {
int day2;
cout << "You were born on a: ";
int day2 = determineDay(month, day, year);
printDayOfBirth(day2);
cout << endl;
cout << "Have a great birthday!!!";
}
else {
cout << "Invalid date";
}
return;
}