Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<ctype.h>
- #include<string.h>
- #include<Windows.h>
- int ascii(int length,char kata[50]){
- system("cls");
- int i;
- int total=0;
- int angka[8];
- printf("Calculating .");
- Sleep(1000);
- printf(" . ");
- Sleep(1000);
- printf(" .\n ");
- for(i=0; i<length; i++){
- printf("%c", kata[i]);
- total +=kata[i]-48;
- angka[i]=kata[i]-48;
- if(i%2==1)
- printf(" ");
- else printf("+");
- }
- Sleep(1000);
- printf("\n%3.d+%-3.d %3.d+%-3.d",angka[0]+angka[1],angka[2]+angka[3],angka[4]+angka[5],angka[6]+angka[7]);
- Sleep(500);
- printf("\n%7.d+%-5.d",angka[0]+angka[1]+angka[2]+angka[3],angka[4]+angka[5]+angka[6]+angka[7]);
- Sleep(200);
- printf("\n= %d\n", total);
- return total;
- }
- void check(char kata[50]){
- system("cls");
- int flag=0,length,i;
- do{
- flag = 1;
- printf("Masukkan tanggal Lahir anda(Min Usia 22thn)\n(Format : ddmmyyyy): ");
- scanf("%s", kata);fflush(stdin);
- length = strlen(kata);
- for(i=0; i<length; i++){
- if(isalpha(kata[i])){
- flag = 0;
- break;
- }
- }
- if(kata[0]-48>3||(kata[0]-48>=3&&kata[1]-48>1)){
- printf("Hari yang anda masukan tidak valid\n");
- flag=0;}
- if(kata[2]-48>1||(kata[2]-48>=1&&kata[3]-48>2)){
- printf("Bulan yang anda masukan tidak valid\n");
- flag=0;}
- if(kata[4]-48!=1||kata[5]-48!=9||(kata[6]-48==9&&kata[7]-48>1)){
- printf("Tahun yang anda masukan tidak valid\n");
- flag=0;}
- }while(flag==0);
- }
- int spesial(int total){
- printf("\n%d + %d =", (total-total%10)/10,total%10);
- total=(total/10)%10+total%10;
- printf("\b\b = %d\n", total);
- return total;
- }
- void result(int total){
- int x=0;
- system("cls");
- do{
- system("cls");
- if(x<50)
- printf("Running some analytical ");
- if(x>=50)
- printf("Preparing the result ");
- printf("%d",x);
- x++;
- }while(x<=100);
- system("cls");
- printf("100%% Loading Complete\n");
- printf("Based On your number (%d), you are ",total);
- if (total==1)
- printf("Leadership, lonely");
- else if (total==2)
- printf("Vocal, loving, emotional");
- else if (total==3)
- printf("Agresive, Impatient, Spritual");
- else if (total==4)
- printf("Inteligent, good planning, orderly");
- else if (total==5)
- printf("Protective, stubborn, good business");
- else if (total==6)
- printf("People & Family oriented, money");
- else if (total==7)
- printf("Lucky, lot of freedom, like to help people");
- else if (total==8)
- printf("Responsible, Stressful");
- else if (total==9)
- printf("Successful, greedy");
- }
- int main(){
- char kata[50];
- int total=0;
- check(kata);
- total=ascii(strlen(kata),kata);
- while(total>=10)
- total=spesial(total);
- result(total);
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement