Mega Code Archive

 
Categories / C / Beginners
 

Program to Delete Duplicates in Array

#include<stdio.h> #include<conio.h> #include<string.h> #include<dos.h> void main() { int i,j,l,t=1; char y,s[15]; clrscr(); s[0]='E'; s[1]='n'; s[2]='t'; s[3]='e'; s[4]='r'; s[5]=' '; s[6]='a'; s[7]=' '; s[8]='s'; s[9]='t'; s[10]='r'; s[11]='i'; s[12]='n'; s[13]='g'; s[14]=NULL; printf("Enter a string "); gotoxy(1,2); while((y=getchar())!=' ') { for(i=3,l=200;i<=24;i++,l=l+50) { gotoxy(t,i); if(y!=' ') { printf("%c",y); gotoxy(t,i-1); printf(" "); sound(l); delay(80); } } t++; } gotoxy(1,1); t=1; for(j=0,l=100;j<14;j++,l=l+50) { if(l>200) l=100; for(i=2;i<24;i++,l++) { gotoxy(t,i); if(s[j]!=' ') { printf("%c",s[j]); gotoxy(t,i-1); printf(" "); sound(l); delay(80); } } t++; } nosound(); getch(); }