aşağıdaki kod, klavyeden alınan cumlenin icindeki harf sayısını ve istenen harfin cumlede bulunma oranını verir. Linked list icin bir ornek teşkil ettiğinden paylaşıma sundum.

Kod:
#include #include #include #include struct cumle; int main() (n->oth)=NULL; printf("cumle %d karakterden olusur\n",a); sayac2=a; printf("aranacak harfi giriniz:"); scanf("%c",&q); n=hp; printf("\n"); for(a=1;n->oth!=NULL;a++) n=n->oth; } if(flag==0) printf("\ncumlede %c bulunmamaktadir\n",q); c=(float)sayac/(float)sayac2; printf("\n\n%c cumlede %d kere bulunmaktadir, bulunma orani: %f\n",q,sayac,c); system("pause"); return 0; }

ayrıca linked list'e eleman ekleme:
varolan 0-1-2-3-4-5-6-7-8-9 list'ine klavyeden girilen bir sayının, değerine gore uygun yere yerleştirilmesi
Orneğin, 3 girdiğinizde, yeni liste 0-1-2-3-3-4-5-6-7-8-9 şeklinde
99 girdiğinizde ise 0-1-2-3-4-5-6-7-8-9-99 şeklinde olacak...

Kod:
#include #include #include #define N 10 struct Node; typedef struct Node dugum; int ekle(int n, dugum **headptr); int main() dowhile(c!=0); tmp=hp; for(a=0;(tmp->next)!=NULL;a++) getch(); return 0; } int ekle(int n, dugum **headptr) del->say=n; del->next=NULL; if(nsay)) else } del->next=ppp; temp->next=del; } return 0; }

Linked list'ten eleman silmek icin:
varolan 0-1-2-3-4-5-6-7-8-9 listesinden, varolan bir elemanı silmek icin gerekli kodlar
Kod:
#include #include #include #define N 10 struct Node; typedef struct Node dugum; int eleman_sil(int n, dugum **headptr); int main() dowhile(c!=0); tmp=hp; for(a=0;(tmp->next)!=NULL;a++) getch(); return 0; } int eleman_sil(int n, dugum **headptr) temp=ppp; ppp=ppp->next; } if(d==0) return -1; if(a==0) else else free(ppp); } return 0; }

__________________