SHOW:
|
|
- or go back to the newest paste.
1 | #include<stdio.h> | |
2 | #include<ctype.h> | |
3 | #include<string.h> | |
4 | #include<Windows.h> | |
5 | ||
6 | int ascii(int length,char kata[50]){ | |
7 | system("cls"); | |
8 | int i; | |
9 | int total=0; | |
10 | int angka[8]; | |
11 | printf("Calculating ."); | |
12 | Sleep(1000); | |
13 | printf(" . "); | |
14 | Sleep(1000); | |
15 | printf(" .\n "); | |
16 | for(i=0; i<length; i++){ | |
17 | printf("%c", kata[i]); | |
18 | total +=kata[i]-48; | |
19 | angka[i]=kata[i]-48; | |
20 | if(i%2==1) | |
21 | printf(" "); | |
22 | else printf("+"); | |
23 | } | |
24 | Sleep(1000); | |
25 | 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]); | |
26 | Sleep(500); | |
27 | printf("\n%7.d+%-5.d",angka[0]+angka[1]+angka[2]+angka[3],angka[4]+angka[5]+angka[6]+angka[7]); | |
28 | Sleep(200); | |
29 | printf("\n= %d\n", total); | |
30 | return total; | |
31 | } | |
32 | void check(char kata[50]){ | |
33 | system("cls"); | |
34 | int flag=0,length,i; | |
35 | do{ | |
36 | flag = 1; | |
37 | printf("Masukkan tanggal Lahir anda(Min Usia 22thn)\n(Format : ddmmyyyy): "); | |
38 | scanf("%s", kata);fflush(stdin); | |
39 | length = strlen(kata); | |
40 | for(i=0; i<length; i++){ | |
41 | if(isalpha(kata[i])){ | |
42 | flag = 0; | |
43 | break; | |
44 | } | |
45 | } | |
46 | if(kata[0]-48>3||(kata[0]-48>=3&&kata[1]-48>1)){ | |
47 | printf("Hari yang anda masukan tidak valid\n"); | |
48 | flag=0;} | |
49 | if(kata[2]-48>1||(kata[2]-48>=1&&kata[3]-48>2)){ | |
50 | printf("Bulan yang anda masukan tidak valid\n"); | |
51 | flag=0;} | |
52 | if(kata[4]-48!=1||kata[5]-48!=9||(kata[6]-48==9&&kata[7]-48>1)){ | |
53 | printf("Tahun yang anda masukan tidak valid\n"); | |
54 | flag=0;} | |
55 | }while(flag==0); | |
56 | } | |
57 | int spesial(int total){ | |
58 | printf("\n%d + %d =", (total-total%10)/10,total%10); | |
59 | - | printf("\b\b = %d\n", total); |
59 | + | |
60 | printf("%d\n", total); | |
61 | Sleep(500); | |
62 | return total; | |
63 | } | |
64 | void result(int total){ | |
65 | int x=0; | |
66 | system("cls"); | |
67 | do{ | |
68 | system("cls"); | |
69 | if(x<50) | |
70 | printf("Running some analytical "); | |
71 | if(x>=50) | |
72 | printf("Preparing the result "); | |
73 | printf("%d",x); | |
74 | x++; | |
75 | }while(x<=100); | |
76 | system("cls"); | |
77 | printf("100%% Loading Complete\n"); | |
78 | printf("Based On your number (%d), you are ",total); | |
79 | if (total==1) | |
80 | printf("Leadership, lonely"); | |
81 | else if (total==2) | |
82 | printf("Vocal, loving, emotional"); | |
83 | else if (total==3) | |
84 | printf("Agresive, Impatient, Spritual"); | |
85 | else if (total==4) | |
86 | printf("Inteligent, good planning, orderly"); | |
87 | else if (total==5) | |
88 | printf("Protective, stubborn, good business"); | |
89 | else if (total==6) | |
90 | printf("People & Family oriented, money"); | |
91 | else if (total==7) | |
92 | printf("Lucky, lot of freedom, like to help people"); | |
93 | else if (total==8) | |
94 | printf("Responsible, Stressful"); | |
95 | else if (total==9) | |
96 | printf("Successful, greedy"); | |
97 | } | |
98 | int main(){ | |
99 | char kata[50]; | |
100 | int total=0; | |
101 | check(kata); | |
102 | total=ascii(strlen(kata),kata); | |
103 | while(total>=10) | |
104 | total=spesial(total); | |
105 | result(total); | |
106 | getchar(); | |
107 | } |