c++ - Age output not calculating -
this question has answer here:
- what special numbers starting zero? 4 answers
patientdemographicinformation patientjones("123456789", "jones", 'a', "mary", "mc donalds department, 555 elm street, apt 2, "666 west side", "san diego", "ca", "76032", "3899", "360", "89054392012", 'f', 02031934); patientjones.printpatientdemographicinformation(); int patientdemographicinformation::getpatientage( ) { time_t t = time(0); // time struct tm * = localtime( & t ); int yearnow = (now->tm_year + 1900); int birthyear = (patientdateofbirth % 10000); return yearnow - birthyear; }
main.cpp:27:50: error: invalid digit "9" in octal constant <-- error...
it not calculate years months , days. used 11171993 birth date , worked. although, need birth date of 02031934 , genuinely date work. welcome.
thank you!
according this reference, beginning of integer constant 0
, in 01011967
, indicates octal notation, consequently makes impossible use 9
in constant.
Comments
Post a Comment