+ 1
Why this ptogram gives negative value for year?
3 Answers
+ 3
you must add i++; to line 21,22 otherwise youâll use the ascii value of â/â
but you probably already know this since youâve done a similar thing at line 17
+ 2
the ascii value of â/â is 47 and you subtract 48 and this is why the output is NEGATIVE ...
for example if your input is â20/01/2003â (as you have commented in your code...)
the output will be :
-10000+2000+000+00+3 = -7997
i++; at line 22 will fix this...
0
Stop using C-style in c++ for real