Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<time.h>
- main()
- {
- srand( time(NULL) );
- int mese2,giorno,anno;
- char mese[12][15] = {"Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"};
- mese2 = rand()%12;
- switch(mese2){
- case 0: giorno = rand()%31; break;
- case 1: giorno = rand()%28; break;
- case 2: giorno = rand()%31; break;
- case 3: giorno = rand()%30; break;
- case 4: giorno = rand()%31; break;
- case 5: giorno = rand()%30; break;
- case 6: giorno = rand()%31; break;
- case 7: giorno = rand()%31; break;
- case 8: giorno = rand()%30; break;
- case 9: giorno = rand()%31; break;
- case 10: giorno = rand()%30; break;
- case 11: giorno = rand()%31; break;
- }
- anno = 2015 - 20;
- printf("Data di nascita: %d %s %s",giorno, mese[mese2], anno);
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment