From 8ef9c53bf75d6950391bd29747889bd456389074 Mon Sep 17 00:00:00 2001 From: naxwh Date: Tue, 25 Jan 2022 11:32:44 +0530 Subject: [PATCH] Removed #include clrscr() and getch() are both part of conio.h. It is primarily used in MS-DOS based compilers. They are kinda unnecessary. They gives error in new compilers. --- APPEND.C | 3 --- BINSEARC.C | 4 ---- BSERREC.C | 3 --- BSTSEARC.C | 3 --- BUBBSORT.C | 3 --- CIRQUEUE.C | 3 --- DHEADLIS.C | 3 --- DOUBLLIS.C | 3 --- EXCHANGESORT.C | 3 --- HEADLIST.C | 2 -- INSSORT.C | 3 --- LINKEDLI.C | 3 --- LINSEARC.C | 3 --- LISTSORT.C | 3 --- PATTERNMATCHING.C | 3 --- POLYARR1.C | 3 --- POLYLIN1.C | 3 --- POSTFIX.C | 3 --- QUEUEARR.C | 3 --- QUEUELIN.C | 3 --- QUIKSORT.C | 3 --- SEARCH2D.C | 3 --- SELSORT.C | 3 --- SORTSTR.C | 4 ---- SPARSE.C | 3 --- SPARSE1.C | 3 --- STACKARR.C | 3 --- STACKLIN.C | 3 --- TREENREC.C | 3 --- TREEREC.C | 3 --- 30 files changed, 91 deletions(-) diff --git a/APPEND.C b/APPEND.C index 0411578..ada7152 100644 --- a/APPEND.C +++ b/APPEND.C @@ -1,9 +1,7 @@ #include -#include void main() { int a[10],b[10],i,j,m,n; - clrscr(); printf("Enter the size of first array: "); scanf("%d",&m); printf("\nEnter %d elements into first array:\n",m); @@ -19,5 +17,4 @@ void main() printf("\nFirst array after appending second array:\n"); for(i=0;i -#include - int search(int [],int,int); void main() { int a[10],i,n,x,loc; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array in ascending order:\n",n); @@ -17,7 +14,6 @@ void main() loc=search(a,n,x); if(loc==-1) printf("\n%d is not found.",x); else printf("\n%d is found at position %d in the array.",x,loc); - getch(); } int search(int a[],int n,int v) diff --git a/BSERREC.C b/BSERREC.C index 26c9207..20484e9 100644 --- a/BSERREC.C +++ b/BSERREC.C @@ -1,5 +1,4 @@ #include -#include int search(int [],int,int); int binsearch(int [],int,int,int); @@ -7,7 +6,6 @@ int binsearch(int [],int,int,int); void main() { int a[10],i,n,x,loc; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array in ascending order:\n",n); @@ -18,7 +16,6 @@ void main() loc=search(a,n,x); if(loc==-1) printf("\n%d is not found.",x); else printf("\n%d is found at position %d in the array.",x,loc+1); - getch(); } int search(int a[],int n,int v) diff --git a/BSTSEARC.C b/BSTSEARC.C index 73f9c26..c5b35d6 100644 --- a/BSTSEARC.C +++ b/BSTSEARC.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct treeNode* treePointer; @@ -20,7 +19,6 @@ void main() int choice,n; do { - clrscr(); printf("\n\tBINARY SEARCH TREE OPERATIONS\n"); printf("\n\t\t1. Create"); printf("\n\t\t2. Search"); @@ -43,7 +41,6 @@ void main() break; default:continue; } - getch(); }while(choice!=3); } diff --git a/BUBBSORT.C b/BUBBSORT.C index 954acb6..14fcd34 100644 --- a/BUBBSORT.C +++ b/BUBBSORT.C @@ -1,12 +1,10 @@ #include -#include void sort(int*,int); void main() { int a[10],n,i; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array :\n",n); @@ -19,7 +17,6 @@ void main() printf("\n\nArray after sorting :"); for(i=0;i -#include #define LENGTH 5 @@ -15,7 +14,6 @@ void main() int ch,n; do { - clrscr(); printf("\n\tQUEUE OPERATIONS\n"); printf("\n\t\t1.ADD"); printf("\n\t\t2.DELETE"); @@ -38,7 +36,6 @@ void main() break; default:continue; } - getch(); }while(ch!=4); } diff --git a/DHEADLIS.C b/DHEADLIS.C index 0b28fee..c2acee8 100644 --- a/DHEADLIS.C +++ b/DHEADLIS.C @@ -1,6 +1,5 @@ #include #include -#include typedef struct listnode* listpointer; @@ -27,7 +26,6 @@ void main() head->next=head->prev=head; do { - clrscr(); printf("\n\tLINKED LIST OPERATIONS\n"); printf("\n\t\t1. CREATE"); printf("\n\t\t2. LIST"); @@ -59,7 +57,6 @@ void main() break; default:continue; } - getch(); }while(choice!=6); } diff --git a/DOUBLLIS.C b/DOUBLLIS.C index 720e5e7..570c490 100644 --- a/DOUBLLIS.C +++ b/DOUBLLIS.C @@ -1,6 +1,5 @@ #include #include -#include typedef struct listnode* listpointer; @@ -25,7 +24,6 @@ void main() int n,pos; do { - clrscr(); printf("\n\tLINKED LIST OPERATIONS\n"); printf("\n\t\t1. CREATE"); printf("\n\t\t2. LIST"); @@ -57,7 +55,6 @@ void main() break; default:continue; } - getch(); }while(choice!=6); } diff --git a/EXCHANGESORT.C b/EXCHANGESORT.C index d14a558..22eb705 100644 --- a/EXCHANGESORT.C +++ b/EXCHANGESORT.C @@ -1,9 +1,7 @@ #include -​#​include​<​conio.h​> void main(void) { int array[5], i, j, temp,n; - ​   ​clrscr​(); printf("Enter the number of elements : "); scanf("%d",&n); printf("Enter %d numbers : ",n); @@ -28,5 +26,4 @@ void main(void) { printf(" %d ",array[i]); } - getch(); } diff --git a/HEADLIST.C b/HEADLIST.C index 3cf334d..a666d03 100644 --- a/HEADLIST.C +++ b/HEADLIST.C @@ -1,6 +1,5 @@ #include #include -#include typedef struct listnode* listpointer; @@ -63,7 +62,6 @@ void main() break; default:continue; } - getch(); }while(choice!=7); } diff --git a/INSSORT.C b/INSSORT.C index 4c59f2d..142abff 100644 --- a/INSSORT.C +++ b/INSSORT.C @@ -1,12 +1,10 @@ #include -#include void sort(int*,int); void main() { int a[10],n,i; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array :\n",n); @@ -19,7 +17,6 @@ void main() printf("\n\nArray after sorting :"); for(i=0;i #include -#include typedef struct listnode* listpointer; @@ -25,7 +24,6 @@ void main() int n,pos; do { - clrscr(); printf("\n\tLINKED LIST OPERATIONS\n"); printf("\n\t\t1. CREATE"); printf("\n\t\t2. LIST"); @@ -57,7 +55,6 @@ void main() break; default:continue; } - getch(); }while(choice!=6); } diff --git a/LINSEARC.C b/LINSEARC.C index 6f4e33f..361bd91 100644 --- a/LINSEARC.C +++ b/LINSEARC.C @@ -1,12 +1,10 @@ #include -#include int search(int [],int,int); void main() { int a[10],i,n,x,loc; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array:\n",n); @@ -17,7 +15,6 @@ void main() loc=search(a,n,x); if(loc==-1) printf("\n%d is not found.",x); else printf("\n%d is found at position %d in the array.",x,loc); - getch(); } int search(int a[],int n,int v) diff --git a/LISTSORT.C b/LISTSORT.C index e65835e..10073bd 100644 --- a/LISTSORT.C +++ b/LISTSORT.C @@ -1,6 +1,5 @@ #include #include -#include typedef struct listnode* listpointer; @@ -21,7 +20,6 @@ void main() int choice; do { - clrscr(); printf("\n\tLINKED LIST OPERATIONS\n"); printf("\n\t\t1. CREATE"); printf("\n\t\t2. LIST"); @@ -39,7 +37,6 @@ void main() break; default:continue; } - getch(); }while(choice!=4); } diff --git a/PATTERNMATCHING.C b/PATTERNMATCHING.C index 647c4f9..2378319 100644 --- a/PATTERNMATCHING.C +++ b/PATTERNMATCHING.C @@ -1,6 +1,5 @@ #include #include -#include void main() { char text[20],pat[20]; @@ -9,7 +8,6 @@ void main() gets(text); printf("Enter the pattern to find : "); gets(pat); - clrscr(); a = strlen(pat); b = strlen(text); @@ -30,5 +28,4 @@ void main() if (flag==0) printf("Not found"); - getch(); } diff --git a/POLYARR1.C b/POLYARR1.C index ef0ab9d..83bf54e 100644 --- a/POLYARR1.C +++ b/POLYARR1.C @@ -1,5 +1,4 @@ #include -#include typedef struct {int coef,exp;} polynomial; @@ -10,7 +9,6 @@ void main() { polynomial p1[10],p2[10],p3[20],p4[50],t; int n1,n2,n3,n4,i,j,k; - clrscr(); printf("Number of terms in first polynomial : "); scanf("%d",&n1); printf("\nEnter %d terms for first polynomial:\n",n1); @@ -53,7 +51,6 @@ void main() print(p3,n3); printf("\nPolynomial product : "); print(p4,n4); - getch(); } void read(polynomial p[],int n) diff --git a/POLYLIN1.C b/POLYLIN1.C index 9099a7b..4b9fae0 100644 --- a/POLYLIN1.C +++ b/POLYLIN1.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct node* polynomial; @@ -14,7 +13,6 @@ void main() { polynomial p,t; int i,n; - clrscr(); printf("Number of terms in the polynomial : "); scanf("%d",&n); printf("\nEnter %d terms for the polynomial:\n",n); @@ -46,5 +44,4 @@ void main() else if(t->exp==1) printf("%dx",t->coef); else printf("%dx^%d",t->coef,t->exp); } - getch(); } diff --git a/POSTFIX.C b/POSTFIX.C index 84fb253..874eb05 100644 --- a/POSTFIX.C +++ b/POSTFIX.C @@ -1,16 +1,13 @@ #include -#include int evaluate(char*); void main() { char exp[15]; - clrscr(); printf("Enter an expression in postfix form : "); gets(exp); printf("\nResult = %d",evaluate(exp)); - getch(); } int evaluate(char *str) diff --git a/QUEUEARR.C b/QUEUEARR.C index 63cbd99..9d1bf2e 100644 --- a/QUEUEARR.C +++ b/QUEUEARR.C @@ -1,5 +1,4 @@ #include -#include #define LENGTH 5 @@ -15,7 +14,6 @@ void main() int ch,n; do { - clrscr(); printf("\n\tQUEUE OPERATIONS\n"); printf("\n\t\t1.ADD"); printf("\n\t\t2.DELETE"); @@ -38,7 +36,6 @@ void main() break; default:continue; } - getch(); }while(ch!=4); } diff --git a/QUEUELIN.C b/QUEUELIN.C index d410d76..7d7cd1c 100644 --- a/QUEUELIN.C +++ b/QUEUELIN.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct queuenode* queuepointer; @@ -21,7 +20,6 @@ void main() int ch,n; do { - clrscr(); printf("\n\tQUEUE OPERATIONS\n"); printf("\n\t\t1.ADD"); printf("\n\t\t2.DELETE"); @@ -44,7 +42,6 @@ void main() break; default:continue; } - getch(); }while(ch!=4); } diff --git a/QUIKSORT.C b/QUIKSORT.C index 5c997e6..d42b7b3 100644 --- a/QUIKSORT.C +++ b/QUIKSORT.C @@ -1,5 +1,4 @@ #include -#include void sort(int*,int); void qsort(int*,int,int); @@ -7,7 +6,6 @@ void qsort(int*,int,int); void main() { int a[10],n,i; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array :\n",n); @@ -20,7 +18,6 @@ void main() printf("\n\nArray after sorting :"); for(i=0;i -#include void main() { int a[10][10],i,j,m,n,x,count=0; - clrscr(); printf("\nEnter the Row and column : "); scanf("%d%d",&m,&n); printf("\nEnter %d elements : ",m*n); @@ -27,5 +25,4 @@ void main() if(count==0) printf("Item Not found"); - getch(); } diff --git a/SELSORT.C b/SELSORT.C index 61f0402..2b8bf38 100644 --- a/SELSORT.C +++ b/SELSORT.C @@ -1,12 +1,10 @@ #include -#include void sort(int*,int); void main() { int a[10],n,i; - clrscr(); printf("Enter the size : "); scanf("%d",&n); printf("\nEnter %d elements into the array :\n",n); @@ -19,7 +17,6 @@ void main() printf("\n\nArray after sorting :"); for(i=0;i -#include #include void sort(char [][15],int); @@ -8,18 +7,15 @@ void main() { char list[10][15]; int i,n; - clrscr(); printf("\nEnter number of strings : "); scanf("%d",&n); printf("\nEnter %d strings:\n",n); - flushall(); for(i=0;i -#include void main() { struct {int r,c,v;} terms[10]; int rows,cols,n,i,j,k; - clrscr(); printf("Enter the order of the sparse matrix : "); scanf("%d%d",&rows,&cols); printf("\nEnter the number of non zero elements : "); @@ -29,5 +27,4 @@ void main() else printf(" 0"); printf("\n"); } - getch(); } diff --git a/SPARSE1.C b/SPARSE1.C index 310db2e..9a55bbf 100644 --- a/SPARSE1.C +++ b/SPARSE1.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct {int r,c,v;} term; @@ -17,7 +16,6 @@ sparse mul(sparse,sparse); void main() { sparse s1,s2,s3,s4; - clrscr(); printf("Enter the first sparse matrix:"); read(&s1); printf("\nEnter the second sparse matrix:"); @@ -32,7 +30,6 @@ void main() printf("\nMatrix product:"); s4=mul(s1,s2); print(s4); - getch(); } void read(sparse* s) diff --git a/STACKARR.C b/STACKARR.C index dd5c84a..ec9040a 100644 --- a/STACKARR.C +++ b/STACKARR.C @@ -1,5 +1,4 @@ #include -#include #define LENGTH 5 @@ -15,7 +14,6 @@ void main() int ch,n; do { - clrscr(); printf("\n\tSTACK OPERATIONS\n"); printf("\n\t\t1.PUSH"); printf("\n\t\t2.POP"); @@ -38,7 +36,6 @@ void main() break; default:continue; } - getch(); }while(ch!=4); } diff --git a/STACKLIN.C b/STACKLIN.C index ac26e0b..de68254 100644 --- a/STACKLIN.C +++ b/STACKLIN.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct stacknode* stackpointer; @@ -21,7 +20,6 @@ void main() int ch,n; do { - clrscr(); printf("\n\tSTACK OPERATIONS\n"); printf("\n\t\t1.PUSH"); printf("\n\t\t2.POP"); @@ -44,7 +42,6 @@ void main() break; default:continue; } - getch(); }while(ch!=4); } diff --git a/TREENREC.C b/TREENREC.C index 21db65b..52b3a06 100644 --- a/TREENREC.C +++ b/TREENREC.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct treeNode* treePointer; @@ -33,7 +32,6 @@ void main() int choice; do { - clrscr(); printf("\n\tBINARY TREE OPERATIONS\n"); printf("\n\t\t1. Create"); printf("\n\t\t2. Traverse preorder"); @@ -62,7 +60,6 @@ void main() break; default:continue; } - getch(); }while(choice!=6); } diff --git a/TREEREC.C b/TREEREC.C index 97bf8f2..556f52c 100644 --- a/TREEREC.C +++ b/TREEREC.C @@ -1,5 +1,4 @@ #include -#include #include typedef struct treeNode* treePointer; @@ -22,7 +21,6 @@ void main() int choice; do { - clrscr(); printf("\n\tBINARY TREE OPERATIONS\n"); printf("\n\t\t1. Create"); printf("\n\t\t2. Traverse preorder"); @@ -62,7 +60,6 @@ void main() break; default:continue; } - getch(); }while(choice!=5); }