Quote (Azrad @ Oct 18 2013 08:01pm)
Hmm no, I dont think so..
My problem looks like this
1, Read a personal ID number into a string variable
2, Validate the ID number, check if the ID was written in the correct format (yymmdd-ssss). If the given ID does not match the correct format display an error message and ask the user to type it again. Notice that the prgram should verify the date (yymmdd) given in the ID so it matches an existing date.. for example 930230 should display error and 930224 should be correct..
3, The program should check if the ID number corresponds to a female or a male.. if the last digit in "ssss" is an odd number then its a male otherwise its a female.
The program should end when the first two numbers are 0. (00mmdd-ssss)
Currently I've done a few functions..
Code
void yymmdd()
{
string personnummer;
int month = 0;
int numberOfDays;
int year = 0;
if (month == 4 || month == 6 || month == 9 || month == 11)
numberOfDays = 30;
else if (month == 02)
{
bool isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
if (isLeapYear == 0)
numberOfDays = 29;
else
numberOfDays = 28;
}
else
numberOfDays = 31;
return numberOfDays;
}
void valid()
{
if personnummer V[i] > V[12]
{
cout << "Error, please type again" << endl;
}
}
void formatcheck()
{
}
void manorwoman()
{
}
void quit()
{
}
int main()
{
}
Edit; No numeric code should be used
This post was edited by bomben on Oct 18 2013 01:44pm