Pinky Free Phone Clip
Solution Lab 2 point 2
date point to many it seemed long, the truth there are many ways to fix and short ... ;)
This is one I propose, if they improve or do better porfa comment.
In general the algorithm checks if the day is right and ultimodiames stored in the variable 1 if the last day of the month and 0 if not.
Well I think that this solution is the maximum amount to copy two pages of a leaf type test ... or not?
# include using namespace std;
int main () {int
year, month, day, ultimodiames = 0;
<<"\nIngrese el dia";
court cin>> day;
<<"\nIngrese el mes";
court cin>> month;
<<"\nIngrese el ano";
court cin> > year;
if (year <=0 || mes> 12 <=0 || dia<=0 || dia>
court if (he == 31) <<"\nFecha ultimodiames = 1;
} else if ((mes == 4 ultimodiames = 1;}
else wrong court <<"\nEl año es bisiesto";
"<<"\nFecha correcta";
if (month == 12 & & day == 31) {year = year +1
;
month = 1;
day = 1; <=30){
<<"\nFecha correcta";
} else if (ultimodiames == 1) {month = month +1
;
day = 1;}
<=29 && ano%4==0){
<<"\nFecha correcta";
else day = day +1;
court return 0;}
<=28){
<<"\nFecha correcta";
0 comments:
Post a Comment