-
Notifications
You must be signed in to change notification settings - Fork 0
/
buyuk_kucuk_harf_ayirma_dby.c
70 lines (48 loc) · 1.27 KB
/
buyuk_kucuk_harf_ayirma_dby.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdio.h>
#include <stdlib.h>
int harf_ayirma(char c)
{
if(c >= 'A' && c <= 'Z')
return 1;
else if(c >= 'a' && c <= 'z')
return 0;
else
return -1;
}
int main()
{
char kelime[100];
int buyuk_sayisi = 0, kucuk_sayisi = 0, sonuc ;
printf("Kelime giriniz :");
scanf("%s",&kelime);
char *p = kelime;
char *bp, *kp;
int i;
for(i=0; *(p+i)!='\0'; i++)
{
sonuc = harf_ayirma(*(p+i));
if(sonuc == 1)
{
buyuk_sayisi++;
if(buyuk_sayisi == 1)
bp = (char*)malloc(sizeof(char)*1);
else
bp = (char*)realloc(bp,sizeof(char)*buyuk_sayisi);
*(bp+buyuk_sayisi-1) = *(p+i);
}
else if(sonuc == 0)
{
kucuk_sayisi++;
if(kucuk_sayisi == 1)
kp = (char*)malloc(sizeof(char)*1);
else
kp = (char*)realloc(kp,sizeof(char)*kucuk_sayisi);
*(kp+kucuk_sayisi-1) = *(p+i);
}
}
*(bp+buyuk_sayisi) = '\0' ;
*(kp+kucuk_sayisi) = '\0' ;
printf("\n\nBuyuk harfler :%s",bp);
printf("\n\nKucuk harfler :%s\n\n",kp);
return 0;
}