Sparse Matrix Operations in C Represent Sparse Matrix using array and perform Matrix Addition, Simple and Fast Transpose. Polynomial representation […]
Tag: C Assignments
Circular Link List using C Language
Circular Link List using C Language Represent single variable polynomial as a circular link list. Accept the terms in the […]
Stack Operations using C Language
Stack Operations using C Language Implement stack as an abstract data type (ADT) using linked list. Use this ADT for […]
Queue Operations using C Language
Queue Operations using C Language Write a program to Queue Operations using C Language to implement the following functions […]
Expression Tree using C Language
Expression Tree in C Write a program to implement Expression Tree using C Language with the following features : Recursive […]
BFS AND DFS Algorithm using C Language
BFS AND DFS Algorithm using C Language Represent a given graph using adjacency list and perform BFS AND DFS Algorithm. Use […]
Breadth First and Depth First Search C Language
Breadth First and Depth First Search C Language Graphs Write a Breadth First and Depth First Search program to Represent […]
Dijkstra Algorithm in C Language
Dijkstra Algorithm in C Language Represent a given graph using adjacency matrix and find the shortest path using Dijkstra’s algorithm. […]
Primitive operations on Sequential file in C language
Primitive operations on Sequential file in C language Implement all primitive operations on Sequential file in C Primitive operations on […]
Hoffmans algorithm in C Language
Hoffmans algorithm in C Implement Huffmans algorithm in C Language. Hoffmans algorithm in C Language Code
1 2 |
<br/>/*Hoffmans algorithm in C Language*/<br/> #include <br/> #include <br/> #include <br/> #define MAX 26 <br/> typedef struct str <br/> { <br/> int freq; <br/> char alpha; <br/> }str; <br/> typedef struct huff <br/> { <br/> struct str info; <br/> struct huff *lc,*rc; <br/> }huff; <br/> typedef struct sll <br/> { <br/> int flag; <br/> union data <br/> { <br/> struct huff * addr; <br/> struct str info; <br/> }data; <br/> struct sll *link; <br/> }sll; <br/> sll *insert(sll *,huff*,sll *); <br/> void insertsort(str *,int ); <br/> sll * createsll(str *); <br/> sll * input(str*); <br/> huff * huffman(sll *,huff *); <br/> void itpost(huff *); <br/> huff *freepa(huff *); <br/> void leveldis(huff *f); <br/> void prefix(huff *,int [],int ); <br/> void main() <br/> { <br/> int ch,a[25],i; <br/> str *s; <br/> sll *f=NULL; <br/> huff *pa=NULL; <br/> s=(str *)calloc(1,26*sizeof(str)); <br/> do <br/> { <br/> clrscr(); <br/> printf("\n\t\tHUFFMAN TREE CREATION\n\t\t1.INPUT\n\t\t2.HUFFMAN TREE\n\t\t3.DISPLAY\n\t\t4.PREFIX CODE\n\t\t5.LEVEL VISE DISPLAY\n\t\t6.EXIT"); <br/> printf("\n\t\tENTER UR CHOICE"); <br/> scanf("%d",&ch); <br/> switch(ch) <br/> { <br/> case 1: <br/> printf("INPUT"); <br/> f=input(s); <br/> break; <br/> case 2: <br/> if(pa!=NULL) <br/> pa=freepa(pa); <br/> printf("HUFFMAN TREE"); <br/> pa=huffman(f,pa); <br/> printf("HUFFMAN TREE IS CREATED"); <br/> break; <br/> case 3: <br/> if(pa==NULL) <br/> printf("MAKE HUFFMAN TREE FIRST"); <br/> else <br/> { <br/> printf("DISPLAY"); <br/> itpost(pa); <br/> } <br/> break; <br/> case 4: <br/> if(pa==NULL) <br/> printf("MAKE HUFFMAN TREE FIRST"); <br/> else <br/> { <br/> printf("PREFIX CODE"); <br/> i=-1; <br/> prefix(pa,a,i); <br/> getch(); <br/> } <br/> break; <br/> case 5: <br/> if(pa==NULL) <br/> printf("MAKE HUFFMAN TREE FIRST"); <br/> else <br/> { <br/> printf("LEVEL VISE DISPLAY"); <br/> leveldis(pa); <br/> } <br/> break; <br/> } <br/> getch(); <br/> }while(ch!=6); <br/> } <br/> sll* input(str *s) <br/> { <br/> sll *f=NULL; <br/> char st[100]; <br/> int k=0,j,i; <br/> for(i=0;i<max;i++) <br=""> (s+i)->freq=0; <br/> flushall(); <br/> gets(st); <br/> for(i=0;st[i]!=NULL;i++) <br/> { <br/> if((64<st[i]&&st[i]<91)||(96<st[i]&&st[i]<123)) <br=""> { <br/> for(j=0;j<k;j++) <br=""> { <br/> if(st[i]==(s+j)->alpha) <br/> break; <br/> } <br/> if(j==k||i==0) <br/> { <br/> (s+k)->alpha=st[i]; <br/> (s+k)->freq++; <br/> k++; <br/> } <br/> else <br/> { <br/> (s+j)->freq++; <br/> } <br/> } <br/> } <br/> insertsort(s,k); <br/> f=createsll(s); <br/> return f; <br/> } <br/> sll * createsll(str *s) <br/> { <br/> sll *nw,*t,*f=NULL; <br/> int i; <br/> for(i=0;(s+i)->freq!=0;i++) <br/> { <br/> nw=(sll *)malloc(sizeof(sll)); <br/> nw->flag=0; <br/> nw->link=NULL; <br/> nw->data.info.freq=(s+i)->freq; <br/> nw->data.info.alpha=(s+i)->alpha; <br/> nw->link=NULL; <br/> if(f==NULL) <br/> f=nw; <br/> else <br/> { <br/> t=f; <br/> while(t->link!=NULL) <br/> t=t->link; <br/> t->link=nw; <br/> } <br/> } <br/> return f; <br/> } <br/> void insertsort(str *a,int n) <br/> { <br/> int i,j; <br/> str temp; <br/> for(i=1;i<n;i++) <br=""> { <br/> temp.freq=(a+i)->freq; <br/> temp.alpha=(a+i)->alpha; <br/> for(j=i-1;j>=0&&(a+j)->freq>temp.freq;j--) <br/> { <br/> (a+j+1)->freq=(a+j)->freq; <br/> (a+j+1)->alpha=(a+j)->alpha; <br/> } <br/> (a+j+1)->freq=temp.freq; <br/> (a+j+1)->alpha=temp.alpha; <br/> } <br/> } <br/> huff * huffman(sll *f,huff *pa) <br/> { <br/> huff *q=NULL,*nw,*lch,*rch,*p; <br/> sll *t,*s; <br/> while(f!=NULL) <br/> { <br/> if(f->flag==0) <br/> { <br/> nw=(huff *)malloc(sizeof(huff)); <br/> nw->info=f->data.info; <br/> nw->lc=nw->rc=NULL; <br/> lch=nw; <br/> } <br/> else <br/> lch=f->data.addr; <br/> t=f; <br/> f=f->link; <br/> free(t); <br/> if(f!=NULL) <br/> { <br/> if(f->flag==0) <br/> { <br/> nw=(huff *)malloc(sizeof(huff)); <br/> nw->info=f->data.info; <br/> nw->lc=nw->rc=NULL; <br/> rch=nw; <br/> } <br/> else <br/> rch=f->data.addr; <br/> t=f; <br/> f=f->link; <br/> nw=(huff *)malloc(sizeof(huff)); <br/> nw->info.freq=lch->info.freq+rch->info.freq; <br/> nw->lc=lch; <br/> nw->rc=rch; <br/> p=nw; <br/> p->info.alpha='\0'; <br/> t->flag=1; <br/> t->data.addr=p; <br/> t->link=NULL; <br/> f=insert(f,p,t); <br/> } <br/> else <br/> p=lch; <br/> } <br/> q=p; <br/> free(t); <br/> return(q); <br/> } <br/> sll *insert(sll *f,huff*p,sll *t) <br/> { <br/> sll *s; <br/> s=f; <br/> if(f!=NULL) <br/> { <br/> if(((p->info.freqdata.info.freq)&&f->flag==0)||((p->info.freqdata.addr->info.freq)&&f->flag==1)) <br/> { <br/> t->link=f; <br/> f=t; <br/> } <br/> else <br/> { <br/> while(s->link!=NULL) <br/> { <br/> if(s->link->data.info.freq>t->data.addr->info.freq&&s->link->flag==0) <br/> { <br/> t->link=s->link; <br/> break; <br/> } <br/> else if(s->link->data.addr->info.freq>t->data.addr->info.freq&&s->link->flag==1) <br/> { <br/> t->link=s->link; <br/> break; <br/> } <br/> s=s->link; <br/> } <br/> } <br/> } <br/> s->link=t; <br/> if(s->link==NULL) <br/> t->link=NULL; <br/> return f; <br/> } <br/> /*void itpost(huff *root) <br/> { <br/> huff *t; <br/> stack *top,*nw; <br/> top=NULL; <br/> t=root; <br/> while(t!=NULL||top!=NULL) <br/> { <br/> if(t!=NULL) <br/> { <br/> nw=(stack*)malloc(sizeof(stack)); <br/> nw->ad=t; <br/> nw->next=top; <br/> nw->flag=0; <br/> top=nw; <br/> t=t->lc; <br/> } <br/> else <br/> { <br/> t=top->ad; <br/> if(top->flag==0) <br/> { <br/> top->flag=1; <br/> t=t->rc; <br/> } <br/> else <br/> { <br/> if(t->lc==NULL&&t->rc==NULL) <br/> printf("%c",t->info.alpha); <br/> else <br/> printf("%d",t->info.freq); <br/> nw=top; <br/> top=top->next; <br/> free(nw); <br/> t=NULL; <br/> } <br/> } <br/> } <br/> getch(); <br/> } */ <br/> huff *freepa(huff *t) <br/> { <br/> huff *q,*n; <br/> if(t!=NULL) <br/> { <br/> q=t->lc; <br/> n=t->rc; <br/> if(q->lc==NULL&&q->rc==NULL) <br/> q=freepa(q); <br/> if(n->lc==NULL&&n->rc==NULL) <br/> n=freepa(n); <br/> } <br/> return q; <br/> } <br/> void leveldis(huff *f) <br/> { <br/> huff *queue[MAX],*t; <br/> int front=-1,rear=-1,i=-1,pl=0,cl=1; <br/> t=f; <br/> if(front==-1) <br/> front++; <br/> rear=(rear+1)%MAX; <br/> queue[rear]=t; <br/> while(cl!=0||pl!=0) <br/> { <br/> if(pl==0) <br/> { <br/> i++; <br/> printf("\nELEMENT IN %d LEVEL:",i); <br/> pl=cl; <br/> cl=0; <br/> } <br/> t=queue[front]; <br/> if(front==rear) <br/> front=rear=-1; <br/> else <br/> front=(front+1)%MAX; <br/> if(t->info.alpha!='\0') <br/> printf("\t%c",t->info.alpha); <br/> else <br/> printf("\t%d",t->info.freq); <br/> if(t->lc!=NULL) <br/> { <br/> if(front==-1) <br/> front++; <br/> rear=(rear+1)%MAX; <br/> queue[rear]=t->lc; <br/> cl++; <br/> } <br/> if(t->rc!=NULL) <br/> { <br/> if(front==-1) <br/> front++; <br/> rear=(rear+1)%MAX; <br/> queue[rear]=t->rc; <br/> cl++; <br/> } <br/> pl--; <br/> } <br/> getch(); <br/> } <br/> void prefix(huff *f,int a[],int i) <br/> { <br/> huff *t; <br/> int m; <br/> t=f; <br/> i++; <br/> if(t!=NULL) <br/> { <br/> if(t->lc==NULL&&t->rc==NULL) <br/> { <br/> printf("\nPREFIX OF %c:",t->info.alpha); <br/> for(m=0;m<i;m++) <br=""> printf("\t%d",a[m]) ; <br/> printf("\tFREQUENCY:%d",t->info.freq); <br/> } <br/> if(t->lc!=NULL) <br/> { <br/> a[i]=0; <br/> prefix(t->lc,a,i); <br/> } <br/> if(t->rc!=NULL) <br/> { <br/> a[i]=1; <br/> prefix(t->rc,a,i); <br/> } <br/> } <br/> } |
[…]
Hash table code in C Language
Hash table code in C Implementation of Hash table using array and handle collisions using Linear probing with replacement and […]
Boundary and Flood Fill Algorithms in C++ Language
Boundary and Flood Fill Algorithms Write a program for Boundary and Flood Fill Algorithms in C++ Language . Boundary and […]
Student Database in C Language
Student Database in C Language Accept student information (e.g. Roll No, Name, Percentage etc.). Display the data in descending order […]
Matrix Operations in C Language
Matrix Operations in C Language Implement following Matrix operations as Given Below: Addition with arrays. Multiplication without pointers to arrays […]
Student Database using Virtual functions in C++
Student Database using Virtual functions in C++ Design a base class consisting of the data members such as name of […]
Exception Handling in C++ Language
Exception Handling in C++ Language Create a class named Television that has data members to hold the model number and […]
Cricket Database Project
Cricket Database in C++
1 2 3 |
#embody <br/> #embody <br/> #embody <br/> #embody <br/> #embody <br/> #embody <br/> #embody <br/> #embody <br/> #embody <br/> /*------------------base class--------------------------------------*/ <br/> class participant <br/> { <br/> float strate,btavg,blavg; <br/> int runs,wic,hiscr,bbol,overs,balls,innings,r1,w1,o1,b1,hcen,cen,i1; <br/> public: <br/> int mat; <br/> char identify[10]; <br/> char nation[10]; <br/> participant(); <br/> void getdata(); <br/> void replace(); <br/> void showdata(); <br/> void calculation(); <br/> void search(); <br/> void modify(); <br/> void updatetest(); <br/> void menu(); <br/> }; <br/> /*----------------------constructor-------------------------------------*/ <br/> participant::participant() <br/> { <br/> strcpy(identify," "); <br/> strcpy(nation," "); <br/> strate=0; <br/> btavg=0; <br/> innings=0; <br/> balls=0; <br/> overs=0; <br/> blavg=0; <br/> runs=0; <br/> wic=0; <br/> mat=0; <br/> hiscr=0; <br/> bbol=0; <br/> cen=0; <br/> hcen=0; <br/> } <br/> /* -----------------------------fun for calculation ----------------------------*/ <br/> void participant::calculation() <br/> { <br/> strate=(float)(runs/balls)*100; <br/> btavg=(float)runs/innings; <br/> blavg=(float)overs/wic; <br/> } <br/> /*---------------------- scan information from consumer ----------------------------------*/ <br/> void participant::getdata() <br/> { <br/> cleardevice(); <br/> settextstyle(1,0,1); <br/> outtextxy(100,50," ENTER DATA "); <br/> settextstyle(0,0,1); <br/> //cout<<"ntt ENTER INFORMATION: nn"; <br/> cout<<"nnntt Title: "; <br/> will get(identify); <br/> cout<<"ntt Nation: "; <br/> will get(nation); <br/> cout<<"ntt Matches: "; <br/> cin>>mat; <br/> cout<<"ntt Innings: "; <br/> cin>>innings; <br/> cout<<"ntt Runs: "; <br/> cin>>runs; <br/> cout<<"ntt Balls Performed: "; <br/> cin>>balls; <br/> cout<<"ntt Fifties: "; <br/> cin>>hcen; <br/> cout<<"ntt Lots of: "; <br/> cin>>cen; <br/> cout<<"ntt Overs Bowled: "; <br/> cin>>overs; <br/> cout<<"ntt Wickets: "; <br/> cin>>wic; <br/> cout<<"ntt Greatest Batting Efficiency: "; <br/> cin>>hiscr; <br/> cout<<"ntt Greatest Bowling Efficiency: "; <br/> cin>>bbol; <br/> } <br/> /*------------------------------ enjoyable used for modification -------------------------*/ <br/> void participant::replace() <br/> { <br/> //cout<<"nntt ENTER DATA OF LAST MATCHn"; <br/> cleardevice(); <br/> settextstyle(1,0,1); <br/> outtextxy(100,50," ENTER DATA OF LAST MATCH"); <br/> settextstyle(0,0,1); <br/> cout<<"nnntt Runs: "; <br/> cin>>r1; <br/> if(r1>100) <br/> cen++; <br/> if(r1>50&&r1<100) <br/> hcen++; <br/> runs+=r1; <br/> cout<<"ntt Wickets: "; <br/> cin>>w1; <br/> wic+=w1; <br/> mat++; <br/> cout<<"ntt OUT/NOTOUT(y/n): "; <br/> char ch=getche(); <br/> if(ch=='y') <br/> innings++; <br/> cout<<"ntt Overs Bowled :"; <br/> cin>>o1; <br/> overs+=o1; <br/> cout<<"ntt Balls Performed"; <br/> cin>>b1; <br/> balls+=b1; <br/> if(hiscr<r1) <br=""> hiscr=r1; <br/> if(bbol<w1) <br=""> bbol=w1; <br/> } <br/> /*------------------------------------- enjoyable for displaying the information ---------------------*/ <br/> void participant::showdata() <br/> { <br/> int x=50; <br/> char str[20]; <br/> cleardevice(); <br/> rectangle(50,150,610,250); <br/> line(50,200,610,200); <br/> for(int i=0;i<6;i++) <br/> { <br/> x+=80; <br/> line(x,150,x,250); <br/> } <br/> outtextxy( 60,170,"MATCHS"); <br/> outtextxy(140,170,"RUNS"); <br/> outtextxy(220,170,"WICKETS"); <br/> outtextxy(300,170,"AVG(BAT)"); <br/> outtextxy(380,170,"AVG(BOL)"); <br/> outtextxy(460,170,"100`s"); <br/> outtextxy(540,170,"50`s"); <br/> outtextxy( 50,280,"BEST PERFORMANCE IN A MATCH ::"); <br/> outtextxy( 50,300,"RUNS : "); <br/> outtextxy( 50,320,"WICKETS :"); <br/> sprintf(str,"%d",mat); <br/> outtextxy(60,220,str); <br/> sprintf(str,"%d",runs); <br/> outtextxy(140,220,str); <br/> sprintf(str,"%d",wic); <br/> outtextxy(220,220,str); <br/> sprintf(str,"%f",btavg); <br/> outtextxy(300,220,str); <br/> sprintf(str,"%f",blavg); <br/> outtextxy(380,220,str); <br/> sprintf(str,"%d",cen); <br/> outtextxy(460,220,str); <br/> sprintf(str,"%d",hcen); <br/> outtextxy(540,220,str); <br/> settextstyle(1,0,1); <br/> sprintf(str,"%s",nation); <br/> outtextxy(50,110,str); <br/> sprintf(str,"%s",identify); <br/> outtextxy(50,90,str); <br/> settextstyle(0,0,1); <br/> sprintf(str,"%d",hiscr); <br/> outtextxy(130,300,str); <br/> sprintf(str,"%d",bbol); <br/> outtextxy(130,320,str); <br/> getch(); <br/> } <br/> fstream file,file1,tfile,tfile1; <br/> int ch1; <br/> /*----------------------------- fundamental ----------------------------------------*/ <br/> void fundamental() <br/> { <br/> participant p; <br/> clrscr(); <br/> int ch,i=0,gm,gd=DETECT; <br/> char st[10]; <br/> int x,y; <br/> x=100; <br/> y=100; <br/> initgraph(&gd,&gm,"g:tcbgi"); <br/> char pname[10],cname[10],password[10]="",c; <br/> setbkcolor(BLUE); <br/> whereas(!kbhit()) <br/> { <br/> settextstyle(1,0,6); <br/> outtextxy(150,200,"CRICKETER`S"); <br/> outtextxy(170,270,"DATABASE"); <br/> } <br/> settextstyle(0,0,1); <br/> cleardevice(); <br/> setcolor(11); <br/> settextstyle(1,0,1); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> if(i<400&&i>370) <br/> delay(40); <br/> delay(10); <br/> } <br/> settextstyle(0,0,1); <br/> cleardevice(); <br/> getch(); <br/> //cleardevice(); <br/> /*------------------ beginning menu ------------------*/ <br/> int tag; <br/> tag: <br/> cleardevice(); <br/> settextstyle(1,0,2); <br/> outtextxy(200,100," 1 :: ONE DAY") ; <br/> outtextxy(200,130," 2 :: TEST") ; <br/> //cin>>ch1; <br/> ch1=getche(); <br/> ch1=ch1-'0'; <br/> settextstyle(0,0,1); <br/> if(ch1==1) <br/> { <br/> do <br/> { <br/> cleardevice(); <br/> //p.menu(); <br/> settextstyle(1,0,2); <br/> outtextxy(200,100," 1 :: ADD RECORDS ") ; <br/> outtextxy(200,130," 2 :: MODIFY RECORDS ") ; <br/> outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ; <br/> outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ; <br/> outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ; <br/> outtextxy(200,250," 6 :: BACK") ; <br/> outtextxy(200,280," 7 :: EXIT") ; <br/> //cin>>ch; <br/> ch=getche(); <br/> ch=ch-'0'; <br/> settextstyle(0,0,1); <br/> change(ch) <br/> { <br/> /*----- ODI insert ----------------------*/ <br/> case 1: <br/> cleardevice(); <br/> file.open("ODI.txt",ios::in|ios::out|ios::ate); <br/> file.seekp(0,ios::finish); <br/> p.getdata(); <br/> p.calculation(); <br/> file.write((char*)&p,sizeof(p)); <br/> file.clear(); <br/> file.shut(); <br/> c=getch(); <br/> break; <br/> /*------- ODI identify clever search --------------------*/ <br/> case 3: <br/> cleardevice(); <br/> cout<<"ntt Title For Search: "; <br/> will get(pname); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> //if(i>250&&i<300) <br/> // delay(40); <br/> delay(10); <br/> } <br/> cleardevice(); <br/> int flag=0; <br/> fi le.open("ODI.txt",ios::in|ios::out|ios::ate); <br/> file.seekp(0,ios::beg); <br/> whereas(file.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.identify,pname)) <br/> { <br/> flag=1; <br/> cout<<"nn"; <br/> p.showdata(); <br/> break; <br/> } <br/> } <br/> file.clear(); <br/> file.shut(); <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> //cout<<"nntt Enter Any Key To Cont."; <br/> //cin>>c; <br/> c=getch(); <br/> break; <br/> /*-------------- ODI modification -------------------------*/ <br/> case 2: <br/> cleardevice(); <br/> cout<<"nttENTER PASSWORD "; <br/> int i=0; <br/> whereas(i<6) <br/> { <br/> password[i]=getche(); <br/> cout<<"*"; <br/> i++; <br/> } <br/> getch(); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> if(i>350&&i<400) <br/> delay(40); <br/> } <br/> cleardevice(); <br/> if(!strcmp("vineet",password)) <br/> { <br/> cout<<"ntt Title For Modification "; <br/> will get(pname); <br/> flag=0; <br/> file.open("ODI.txt",ios::in|ios::out|ios::ate); <br/> file1.open("temp1.txt",ios::in|ios::out|ios::ate); <br/> if(!tfile1) <br/> cout<<"nerror"; <br/> file1.seekp(0,ios::beg); <br/> file.seekp(0,ios::beg); <br/> whereas(file.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.identify,pname)) <br/> { <br/> flag=1; <br/> p.replace(); <br/> p.calculation(); <br/> file1.write((char*)&p,sizeof(p)); <br/> } <br/> else <br/> { <br/> tfile1.write((char*)&p,sizeof(p)); <br/> } <br/> } <br/> file.clear(); <br/> file.shut(); <br/> file1.clear(); <br/> file1.shut(); <br/> if(flag==1) <br/> { <br/> take away("ODI.txt"); <br/> rename("temp1.txt","ODI.txt"); <br/> } <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> } <br/> else <br/> cout<<"ntt Mistaken Password"; <br/> c=getch(); <br/> break; <br/> /*------------ ODI nation clever search --------------*/ <br/> case 4: <br/> cleardevice(); <br/> cout<<"ntt Nation`s Title For Search: "; <br/> will get(cname); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> //if(i>333&&i<400) <br/> // delay(40); <br/> } <br/> cleardevice(); <br/> flag=0; <br/> file.open("ODI.txt",ios::in|ios::out|ios::ate); <br/> file.seekp(0,ios::beg); <br/> whereas(file.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.nation,cname)) <br/> { <br/> flag=1; <br/> cout<<"nn"; <br/> p.showdata(); <br/> } <br/> } <br/> file.clear(); <br/> file.shut(); <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> //cout<<"nntt Enter Any Key To Cont."; <br/> //cin>>c; <br/> c=getch(); <br/> break; <br/> /*------ ODI checklist of gamers ---------------------*/ <br/> case 5: <br/> cleardevice(); <br/> cout<<"ntt Nation`s Title For Search: "; <br/> will get(cname); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> } <br/> cleardevice(); <br/> flag=0; <br/> file.open("ODI.txt",ios::in|ios::out|ios::ate); <br/> file.seekp(0,ios::beg); <br/> whereas(file.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.nation,cname)) <br/> { <br/> flag=1; <br/> settextstyle(1,0,1); <br/> //cout<<"nntt"<<p.identify; <br=""><br/><br/> sprintf(st,"%s",p.identify); <br/> outtextxy(x,y,st); <br/> y=y+30; <br/> settextstyle(0,0,1); <br/> } <br/> } <br/> file.clear(); <br/> file.shut(); <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> //cout<<"nntt Enter Any Key To Cont."; <br/> //cin>>c; <br/> c=getch(); <br/> break; <br/> case 6: <br/> goto tag; <br/> //break; <br/> case 7: <br/> exit(0); <br/> break; <br/> } <br/> }whereas(1); <br/> } <br/> if(ch1==2) <br/> { <br/> do <br/> { <br/> cleardevice(); <br/> //p.menu(); <br/> settextstyle(1,0,2); <br/> outtextxy(200,100," 1 :: ADD RECORDS ") ; <br/> outtextxy(200,130," 2 :: MODIFY RECORDS ") ; <br/> outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ; <br/> outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ; <br/> outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ; <br/> outtextxy(200,250," 6 :: BACK") ; <br/> outtextxy(200,280," 7 :: EXIT") ; <br/> //cin>>ch; <br/> ch=getche(); <br/> ch=ch-'0'; <br/> settextstyle(0,0,1); <br/> change(ch) <br/> { <br/> /*------------------ TEST insert ------------------*/ <br/> case 1: <br/> cleardevice(); <br/> tfile.open("TEST.txt",ios::in|ios::out|ios::ate); <br/> tfile.seekp(0,ios::finish); <br/> p.getdata(); <br/> p.calculation(); <br/> tfile.write((char*)&p,sizeof(p)); <br/> tfile.clear(); <br/> tfile.shut(); <br/> break; <br/> /*------------------ TEST identify clever search ------------------*/ <br/> case 3: <br/> cleardevice(); <br/> cout<<"ntt Title For Search: "; <br/> will get(pname); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> if(i>350&&i<400) <br/> delay(40); <br/> } <br/> cleardevice(); <br/> int flag=0; <br/> tfile.open("TEST.txt",ios::in|ios::out|ios::ate); <br/> tfile.seekp(0,ios::beg); <br/> whereas(tfile.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.identify,pname)) <br/> { <br/> flag=1; <br/> cout<<"nn"; <br/> p.showdata(); <br/> break; <br/> } <br/> } <br/> tfile.clear(); <br/> tfile.shut(); <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> c=getch(); <br/> break; <br/> /*------------------ TEST modification ------------------*/ <br/> case 2: <br/> cleardevice(); <br/> cout<<"nttENTER PASSWORD"; <br/> int i=0; <br/> whereas(i<6) <br/> { <br/> password[i]=getche(); <br/> cout<<"*"; <br/> i++; <br/> } <br/> getch(); <br/> cleardevice(); <br/> setcolor(10 ); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> if(i>350&&i<400) <br/> delay(40); <br/> } <br/> cleardevice(); <br/> if(!strcmp("vineet",password)) <br/> { <br/> cout<<"ntt Title For Modification "; <br/> will get(pname); <br/> flag=0; <br/> tfile.open("TEST.txt",ios::in|ios::out|ios::ate); <br/> tfile1.open("temp1.txt",ios::in|ios::out|ios::ate); <br/> if(!tfile1) <br/> cout<<"nerror"; <br/> tfile1.seekp(0,ios::beg); <br/> tfile.seekp(0,ios::beg); <br/> whereas(tfile.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.identify,pname)) <br/> { <br/> flag=1; <br/> cout<<"ntt Enter Knowledge For First Inning: "; <br/> p.replace(); <br/> cout<<"ntt Enter Knowledge For Second Inning: "; <br/> p.replace(); <br/> p.mat--; <br/> p.calculation(); <br/> tfile1.write((char*)&p,sizeof(p)); <br/> } <br/> else <br/> { <br/> tfile1.write((char*)&p,sizeof(p)); <br/> } <br/> } <br/> tfile.clear(); <br/> tfile.shut(); <br/> tfile1.clear(); <br/> tfile1.shut(); <br/> if(flag==1) <br/> { <br/> take away("TEST.txt"); <br/> rename("temp1.txt","TEST.txt"); <br/> } <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> } <br/> else <br/> cout<<"ntt Mistaken Password"; <br/> c=getch(); <br/> break; <br/> /*------------------ TEST nation clever search ------------------*/ <br/> case 4: <br/> cleardevice(); <br/> cout<<"ntt Nation`s Title For Search: "; <br/> will get(cname); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> if(i>350&&i<400) <br/> delay(40); <br/> } <br/> cleardevice(); <br/> flag=0; <br/> tfile.open("TEST.txt",ios::in|ios::out|ios::ate); <br/> tfile.seekp(0,ios::beg); <br/> whereas(tfile.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.nation,cname)) <br/> { <br/> flag=1; <br/> cout<<"nn"; <br/> p.showdata(); <br/> } <br/> } <br/> tfile.clear(); <br/> tfile.shut(); <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> break; <br/> /*------------------ TEST checklist ------------------*/ <br/> case 5: <br/> cleardevice(); <br/> cout<<"ntt Nation`s Title For Search: "; <br/> will get(cname); <br/> cleardevice(); <br/> setcolor(10); <br/> outtextxy(100,380,"LOADING..."); <br/> for(i=0;i<401;i++) <br/> { <br/> outtextxy(100+i,400,"#"); <br/> delay(10); <br/> if(i>350&&i<400) <br/> delay(40); <br/> } <br/> cleardevice(); <br/> flag=0; <br/> tfile.open("TEST.txt",ios::in|ios::out|ios::ate); <br/> tfile.seekp(0,ios::beg); <br/> whereas(tfile.learn((char*)&p,sizeof(p))) <br/> { <br/> if(!strcmp(p.nation,cname)) <br/> { <br/> flag=1; <br/> settextstyle(1,0,1); <br/> //cout<<"nntt"<<p.identify; <br=""><br/><br/> sprintf(st,"%s",p.identify); <br/> outtextxy(x,y,st); <br/> y=y+30; <br/> settextstyle(0,0,1); <br/> //cout<<"nntt"<<p.identify; <br=""><br/><br/> } <br/> } <br/> file.clear(); <br/> file.shut(); <br/> if(flag==0) <br/> cout<<"ntt File Not Discovered"; <br/> //char c; <br/> //cout<<"nntt Enter Any Key To Cont."; <br/> //cin>>c; <br/> c=getch(); <br/> break; <br/> case 6: <br/> goto tag; <br/> case 7: <br/> exit(0); <br/> break; <br/> } <br/> }whereas(1); <br/> } <br/> } <br/> /* ------------------------------end of fundamental -------------------------------*/ |
Supply projectgeek.com
Banking project in c language source code
Banking project in C Language Assertion : Develop a Banking project in c language which can implement following options or […]
GCD of two integers Code in C Language
GCD of two integers Code in C Language Write a GCD of two integers program in C to compute the […]
Find prime numbers in C Language
Prime numbers in C Language Write a prime numbers in C Language program to generate prime numbers between 1 and n. […]