Skip to main content

Posts

Showing posts from May, 2012

Remove programs from startup in Windows 7

How to remove programs from startup in Windows 7 / How to use msconfig Improve Windows Startup 1. Goto Windows start button and then type msconfig in search box. 2. Select msconfig.exe . 3. Unchecked those programs that you don't want to execute at the startup. 4. Restart to save changes.

Why does Windows show files and folders in green letters

When Windows shows files and folders in green letters it means that those files and folders are encrypted. File Encryption in Windows 7

How to turn off compression in Windows 7

                                                                                 Next>>Turn off blue highlighting of file name letters Find the folder containing your blue-lettered files or folders. (Or, if  all  of your file names and folders have blue letters, find that drive’s icon in the Start menu’s Computer program.) Right-click the folder (or your drive’s icon) containing the blue files and choose Properties from the pop-up menu. Click to remove the checkmark in the checkbox called, “Compress drive to save disk space.” (If you’re turning off compression for a folder or file, click the Advanced button to reveal that “Compress contents to save disk space” checkbox.) After unchecking the compression checkbox (shown below), click the OK button.

Why does Windows show files and folder in blue letters / text

                                                                                             Next>> Turn off compression in windows 7 Windows normally shows files and folders in black letters. When it turns to blue letters, it means that those files and folders are compressed or compacted to save disk space. It automatically decompressed when you open them. To turn off the blue color highlighting but keep compression                                 Follow these steps: -  Click the Start button and open Computer. Click the Organize button, choose Folder and Search Options from the drop-down menu, and click the View tab. Click to remove the c...

Radix Sort in C Language

Program to implement Radix Sort in C  #include<stdio.h> #include<conio.h> typedef struct queue {    int front,rear;    int item[10]; }q; void enqueue(q* qp,int val) {    (qp)->rear++;    (qp)->item[(qp)->rear]=val;    return; } int dequeue(q* qp) {    int val;    val=(qp)->item[(qp)->front];    (qp)->front++;    return val; } int empty(q* qp) {    if((qp)->rear<(qp)->front)  return 1;    return 0; } void radix(int*a,int m,int n) {    q qu[10];    int i,j,r,d=1,k;    for(i=1;i<=m;i++)    {  for(j=0;j<10;j++)  { qu[j].rear=-1; qu[j].front=0;  }  for(j=0;j<n;j++)  { r=a[j]%(d*10); r=r/d; enqueue(&qu[r],a[j]);  }  d*=10;  k=0;  for(j=0;j<10;j++) ...

Difference between Spanning tree and Minimal Spanning Tree

Spanning Tree A spanning tree of a connected, undirected graph  G  can also be defined as a maximal set of edges of  G  that contains no cycle, or as a minimal set of edges that connect all vertices. A sub-graph T of a connected graph G(V,E) is called a Spanning Tree if T is a tree and if T includes every vertex of G i.e. V(T)=V(G). If |V|=n and |E|=m, then the spanning tree of G must have n vertices and hence n-1 edges. The resultant spanning ensure that the graph remain connected and further there is no circuit in it. Two algorithms for finding a spanning tree are BFS ( Breadth First Search ) and DFS ( Depth First Search ). Minimum Spanning Tree A  minimum spanning tree  ( MST ) or  minimum weight spanning tree  is then a spanning tree with weight less than or equal to the weight of every other spanning tree. Two algorithms commonly used,  Prim's algorithm  and  Kruskal's algorithm . Note :- Differen...

To Implement Graph using Adjacency List in C

Program to implement Graph using Adjacency List  and traversing using DFS and BFS in C  #include<stdio.h>  #include<conio.h>  #include<alloc.h>  #define max 10  struct node  {  int vertex;  struct node *next;  };  typedef struct node* nodeptr;  typedef struct queue  { int front,rear; int arr[max];  };  typedef struct stack  { int top; int arr[max];  };  nodeptr getnode()  { nodeptr p; p=(nodeptr)malloc(sizeof(struct node)); p->next=NULL; return p;  }   int empty(struct stack *s)   {  if(s->top==-1)  { return 1;  }  else return 0;   }   void push(struct stack *s,int x)   { if(s->top==max-1) printf("\n Queue Overflow"); else { s->top++; s->arr[s->top]=x; }   }   int pop(struct stack *s)   { in...

Sparse Matrix using Array in C

Program to implement Sparse Matrix using Array in C language #include<stdio.h> #include<conio.h>  int spa[10][10];  void spmatrix(int,int,int);  void main()  { int  i,j,n,m,num,elem=0;    clrscr();    printf("\nenter no. of rows: ");    scanf("%d",&n);    printf("\nenter no. of column: ");    scanf("%d",&m);    printf("\nenter the elements of array\n");    for(i=0;i<n;i++)    { for(j=0;j<m;j++)      { scanf("%d",&spa[i][j]);      }    }    printf("\nmatrix:\n");    for(i=0;i<n;i++)    {for(j=0;j<m;j++)     { printf(" %d",spa[i][j]);     }     printf("\n");    }      for(i=0;i<n;i++)    { for(j=0;j<m;j++)      { if(spa[i][j]!=0)        elem++; ...

Program to implement Circular Header Linked List in C

#include<stdio.h> #include<conio.h> int item,c=0; struct node {  int num;  struct node *next;  }*start=NULL,*last=NULL;  typedef struct node node;  typedef struct node* nptr;  int count();  void ins_beg();  void ins_bet();  void ins_end();  void del_beg();  void del_bet();  void del_end();  void traverse();  void main()  {  int num;  clrscr();  while(1)  { clrscr();  printf("\nÛÛÛÛÛ MENU ÛÛÛÛÛ");  printf("\n1.INSERTION_BEG");  printf("\n2.INSERTION_BET");  printf("\n3.INSERTION_END");  printf("\n4.DELETION_BEG");  printf("\n5.DELETION_BET");  printf("\n6.DELETION_END");  printf("\n7.TRAVERSE");  printf("\n8.EXIT");  printf("\nENTER YOUR CHOICE: ");  scanf("%d",&num);  switch(num)  {   case 1:ins_beg(); break;   case 2:ins_bet(); break;   case 3:ins_en...

To implement Friend Class

#include<iostream.h> #include<conio.h>  class boy  { private:    int income1,income2;    public:    void setdata(int n1,int n2)    { income1=n1;      income2=n2;    }    friend class girl;  };  class girl  { int income;    public:    int g_fun(boy b1)    { return b1.income1+b1.income2;  }    void set_data(int n)    { income=n; }    void show()    { boy b1;      b1.setdata(300,500);      cout<<"\n\n  boy income = "<<b1.income1;      cout<<"\n\n  girl income = "<<income;    }  };   void main()   { boy b1;     girl g1;     clrscr();     b1.setdata(100,200);     g1.set_data(300);     g1.show();     cout<...

To implement Copy Constructor in C++

#include<iostream.h> #include<conio.h>  class myclass  { private:    int a;    public:    myclass(int a1)    { a=a1;      cout<<"\n\n  This is previous value:  "<<a;    }    myclass(myclass &obj)    { a=obj.a;      cout<<"\n\n  This is copied value: "<<a;    }  };  void main()  { clrscr();    myclass m1(333);    myclass m2(m1);    getch();  }

Reverse a string using C++ program

#include<iostream.h> #include<conio.h>  void main()  { char *str,*a;    int i;    clrscr();    printf("\n enter a string: ");    gets(str);    cout<<&str;    for(i=0;str[i]!='\0';i++)    {}    a=&str[i];    a--;    for(;a!=str;a--)    { printf("%c",*a);    }    printf("%c",*a);    getch();    }

Selection Sort using C program

#include<stdio.h> #include<conio.h> void main() {int i,j,a[5],temp;  clrscr();  printf("enter elements :\n");  for(i=0;i<5;i++)  {  scanf("%d",&a[i]);  }  for(i=0;i<=4;i++)  {for(j=i+1;j<=4;j++)   {if(a[i]>a[j])    {temp=a[i];     a[i]=a[j];     a[j]=temp;    }   }  }  printf("\n\n After sorting \n");  for(i=0;i<5;i++)  {printf(" %d",a[i]);  }  getch();  }

Merge two sorted Array

C program to merge two sorted array #include<stdio.h> #include<conio.h>  void main()  { int a[10],b[10],c[20],i,j=0,a_size,b_size;    int *p1,*p2,*p3,*p4;    clrscr();    printf("\nenter the size of A: ");    scanf("%d",&a_size);    printf("\nenter the size of B: ");    scanf("%d",&b_size);    p1=&a[0];    p2=&a[a_size-1];    p3=&b[0];    p4=&b[b_size-1];    printf("\n\ninsert elements of A:(in ascending order)\n");    for(i=0;i<a_size;i++)    { scanf("%d",&a[i]);    }    printf("\n\ninsert elements of B:(in ascending order)\n");    for(i=0;i<b_size;i++)    { scanf("%d",&b[i]);    }    if(a_size<=b_size)    {     while(p1<=p2)     { if(*p1<*p3)       { c[j]=*p1; j++; p1++;   ...

Macro - Pragma in C

C program to show usage of pragma macro #include<stdio.h> #include<conio.h>  void earth();  void moon();  #pragma startup earth  #pragma exit moon void main() {printf("\n\n We are in the space"); }  void earth()  {clrscr();   printf("\n\n We are on the earth");  }  void moon()  {printf("\n\n We are on the moon");  getch();  }

C program to create student information system of 10 students in the file

#include<stdio.h> #include<conio.h>  struct student  { char name[20];    int rollno;  }st[10];  void main()  {int var,i;   char ch='y';   FILE *pk=fopen("student.txt","w");   clrscr();   if(pk==NULL)   { printf("\n FILE DOES NOT EXIST ");     getch();     exit(0);   }   while(ch=='y')   { printf("\n Enter records:\n");     for(i=0;i<10;i++)     {       printf("\n Enter name: ");       scanf("%s",st[i].name);       printf("\n Enter roll no.: ");       scanf("%d",&st[i].rollno);       fprintf(pk," %s %d\n",st[i].name,st[i].rollno);     }     printf("\n\n Do you want to continue(yes-Y): ");     fflush(stdin);     scanf("%c",&ch);   }   fclose(pk);   clrscr();   pk=fopen("student.txt","r")...

C program to read data of structure in existing file using fscanf()

#include<stdio.h> #include<conio.h>  struct emp  {char name[20];   int id;   }e;  void main()  { int vb;    FILE *pk=fopen("keviv.txt","a+");    clrscr();     if(pk==NULL)     { printf("\n\n FILE DOES NOT EXIST");       getch();       exit(0);     }     while(1)     { vb=fscanf(pk,"%s%d",e.name,&e.id);       if(vb==EOF)        break;       printf("\n\n Name: %s\n ID: %d",e.name,e.id);     }     fclose(pk);     getch();     }

C program to read strings from existing file using fgets()

#include<stdio.h> #include<conio.h>  void main() { char s[50];   int len=0;   FILE * pk=fopen("keviv.txt","r");   clrscr();   if(pk==NULL)   { printf("\n FILE DOES NOT EXIST ");     getch();     exit(0);   }   while(1)   { len=fgets(s,49,pk);     if(len==NULL)       break;     puts(s);   }   getch();   fclose(pk);   }

C program to write strings in existing file using fputs()

#include<stdio.h> #include<string.h> #include<conio.h>  void main()  {    char s[50];    FILE *pk=fopen("keviv.txt","w++");    clrscr();    if(pk==NULL)    { printf("\n FILE DOES NOT EXIST ");      getch();      exit(0);    }    while(1)    { gets(s);      if(strlen(s)==NULL)        break;      fputs(s,pk);    }    fclose(pk);  }

C program to read & write structure data from existing file using fread() & fwrite() functions

/* program to read & write structure data from existing file    using fread() & fwrite() functions */ #include<stdio.h> #include<conio.h>  struct emp  {char name[20];   int id;   }e;  void main()  { char ch='y';    FILE *pk=fopen("keviv.txt","aw+");    clrscr();     if(pk==NULL)     { printf("\n\n FILE DOES NOT EXIST");       getch();       exit(0);     }    while(ch=='y')    { printf("\n\n Enter records of employee:\n");      printf("\n Enter name: ");      scanf("%s",e.name);      printf("\n Enter ID: ");      scanf("%d",&e.id);      fwrite(&e,sizeof(e),1,pk);      printf("\n\n Do u want to continue... ");      fflush(stdin);      scanf("%c",&ch);    }  ...

C program to write data of a structure in existing file using fprintf()

#include<stdio.h> #include<conio.h>  struct emp  {char name[20];   int id;   }e;  void main()  { char ch='y';    int i;    FILE *pk=fopen("keviv.txt","a+");    clrscr();     if(pk==NULL)     { printf("\n\n FILE DOES NOT EXIST");       getch();       exit(0);     }    while(ch=='y')    { printf("\n\n Enter records of employee:\n");      printf("\n Enter name: ");      scanf("%s",e.name);      printf("\n Enter ID: ");      scanf("%d",&e.id);      //i=ftell(pk);      //fseek(pk,i,0);      fprintf(pk," %s %d\n",e.name,e.id);      printf("\n\n Do u want to continue...(Y/N): ");      fflush(stdin);      scanf("%c",&ch);    }    fclose(pk);...

C program to write characters in existing file using fputc()

#include<stdio.h> #include<conio.h>  void main()  {char ch;   FILE *vk=fopen("vvv.txt","wb"); //to write"w" in the file   clrscr();   if(vk==NULL)            //if file doesnot exit(NULL), exit from program    {     printf("\n\n File does not exit \n");     exit(0);     }     printf("\n\n Enter 0 to exit ");    while(1)    {ch=getche();     if(ch=='0')      break;     fputc(ch,vk);     }    fclose(vk);     getch();     }

C program to read characters from existing file using fgetc() function

#include<stdio.h> #include<conio.h>  void main()  {char ch;   FILE *fp=fopen("c:\\tc\\data_file.txt","r");   clrscr();   if(fp==NULL)    {     printf("\n\n File does not exist \n");     getch();     exit(0);     }    while(1)    {ch=fgetc(fp);     if(ch==EOF)      break;     putc(ch,stdout);     }    fclose(fp);     getch();   }

Bubble Sorting using C program

#include<stdio.h> #include<conio.h> void main() {int i,j,a[5],temp;  clrscr();  printf("enter elements :\n");  for(i=0;i<5;i++)  {  scanf("%d",&a[i]);  }  for(i=0;i<=4;i++)  {for(j=0;j<=4-i-1;j++)   {if(a[j]>a[j+1])    {temp=a[j];     a[j]=a[j+1];     a[j+1]=temp;    }   }  }  printf("\n\n After sorting \n");  for(i=0;i<5;i++)  {printf(" %d",a[i]);  }  getch();  }

Delete Alternate Nodes in Linked List using C program

/* To delete alternative nodes in the linked list */ #include<stdio.h> #include<conio.h>  void inst_end();  void del_beg();  void traverse();  struct node  { int num;    struct node *next;  }*start=NULL;  typedef struct node node;  typedef struct node* nptr;  void main()  { char choice;    while(1)    {    clrscr();    printf("-------LINKED LIST-------\n\n");    printf(" 1.Insertion\n");    printf(" 2.Deletion\n");    printf(" 3.Traverse\n");    printf(" 4.Exit\n\n");    printf(" Enter your choice: ");    fflush(stdin);    scanf("%c",&choice);    switch(choice)    { case '1': inst_end();     break;      case '2': del_beg();     break;      case '3': traverse();     break;   ...

Circular Linked List using C

#include<stdio.h> #include<conio.h> #include<stdlib.h> struct node {  int num;  struct node *next;  }*start=NULL,*last=NULL;  typedef struct node node;  typedef struct node* nptr;  int count()  {  int c=1;  nptr p;  p=start;  while(p->next!=start)  {   p=p->next;   c++;   }   return c++;   }  void ins_beg() { int item; nptr p,q; p=(nptr)malloc(sizeof(node)); printf("\nenter the item: "); scanf("%d",&item); p->num=item; if(start==NULL) { last=start=p; p->next=start; } else { q=start; while(q->next!=start) q=q->next; p->next=start; start=p; q->next=start; } } void ins_end() { int item; nptr p,q; p=(nptr)malloc(sizeof(node)); printf("\nenter the item: "); scanf("%d",&item); p->num=item; if(start==NULL) { start=p; p->next=start; } else { last->next=p; p->next=start; last=p; } }...

Quick Sort of an Array List using C

#include <stdio.h> #include <conio.h> int split ( int*, int, int ) ; void main( ) {     int arr[10] = { 11, 2, 9, 13, 57, 25, 17, 1, 90, 3 } ;     int i ;     void quicksort ( int *, int, int ) ;     clrscr( ) ;     printf ( "Quick sort.\n" ) ;     printf ( "\nArray before sorting:\n") ;     for ( i = 0 ; i <= 9 ; i++ )         printf ( "%d\t", arr[i] ) ;     quicksort ( arr, 0, 9 ) ;     printf ( "\nArray after sorting:\n") ;     for ( i = 0 ; i <= 9 ; i++ )         printf ( "%d\t", arr[i] ) ;     getch( ) ; } void quicksort ( int a[ ], int lower, int upper ) {     int i ;     if ( upper > lower )     {         i = split ( a, lower, upper ) ;         quicksort ( a, lower, i - 1 ) ;         qu...

Heap Sort implementation using C

#include <stdio.h> #include <conio.h> void makeheap ( int [ ], int ) ; void heapsort ( int [ ], int ) ; void main( ) {     int arr[10] = { 11, 2, 9, 13, 57, 25, 17, 1, 90, 3 } ;     int i ;     clrscr( ) ;     printf ( "Heap Sort.\n" ) ;     makeheap ( arr, 10 ) ;     printf ( "\nBefore Sorting:\n" ) ;     for ( i = 0 ; i <= 9 ; i++ )         printf ( "%d\t", arr[i] ) ;     heapsort ( arr, 10 ) ;     printf ( "\nAfter Sorting:\n" ) ;     for ( i = 0 ; i <= 9 ; i++ )         printf ( "%d\t", arr[i] ) ;     getch( ); } void makeheap ( int x[ ], int n ) {     int i, val, s, f ;     for ( i = 1 ; i < n ; i++ )     {         val = x[i] ;         s = i ;         f = ( s - 1 ) / 2 ;     ...

Sorting in Linked List

#include<stdio.h> #include<conio.h>  void inst_end();  void traverse();  void sorting();  struct node  { int num;    struct node *next;  }*start=NULL;  typedef struct node node;  typedef struct node* nptr;  void main()  { char choice;    while(1)    {    clrscr();    printf("-------LINKED LIST-------\n\n");    printf(" 1.Insertion \n");    printf(" 2.Sorting\n");    printf(" 3.Traverse\n");    printf(" 4.Exit\n\n");    printf(" Enter your choice: ");    fflush(stdin);    scanf("%c",&choice);    switch(choice)    { case '1': inst_end();       break;      case '2': sorting();       break;      case '3': traverse();       break;      case '4': exit(0); ...

Binary Search Tree using C

BST (Binary Search Tree) implementation using C language Operations: - Create tree, Preorder traversal, Postoreder treaversal, and Inoreder traversal /* BINARY SEARCH TREE */ #include<stdio.h> #include<conio.h>   struct node   { int info;     struct node *left_child;     struct node *right_child;   }*p=NULL;   typedef struct node node;   typedef struct node * nptr;   //nptr p=NULL;   nptr create_tree(nptr,int);   void postorder(nptr);   void preorder(nptr);   void inorder(nptr);     void main()   { int ch,num;          while(1)     { clrscr();       printf("\nBINARY SEARCH TREE \n\n");       printf(" 1.Create tree\n");       printf(" 2.Inorder traversal\n");       printf(" 3.Preorder traversal\n");       printf(" 4.Postorder traversal\n");       printf(" 5.Exit\n"...

Dynamic Queue Implementation using Linked List

#include<stdio.h> #include<conio.h>  void insertion();  void deletion();  void traverse();  struct node  { int num;    struct node *next;  }*front=NULL,*rear=NULL;  typedef struct node node;  typedef struct node* nptr;  void main()  { char choice;    while(1)    {    clrscr();    printf("DYNAMIC QUEUE\n\n");    printf(" 1.Insertion\n");    printf(" 2.Deletion\n");    printf(" 3.Traverse\n");    printf(" 4.EXIT\n");    printf(" Enter your choice: ");    fflush(stdin);    scanf("%c",&choice);    switch(choice)    { case '1': insertion();       break;      case '2': deletion();       break;      case '3': traverse();       break;      case '4': exit(0); ...

Dynamic Stack Implementation using Linked List

#include<stdio.h> #include<conio.h>  void push();  void pop();  void traverse();  struct node  { int num;    struct node *next;  }*top=NULL;  typedef struct node node;  typedef struct node* nptr;  void main()  { char choice;    while(1)    {    clrscr();    printf("-----DYNAMIC STACK-----\n\n");    printf(" 1.PUSH\n");    printf(" 2.POP\n");    printf(" 3.TRAVERSE\n");    printf(" 4.EXIT\n");    printf(" Enter your choice: ");    fflush(stdin);    scanf("%c",&choice);    switch(choice)    { case '1': push();       break;      case '2': pop();       break;      case '3': traverse();       break;      case '4': exit(0);      default: printf(...

Doubly Linked List using C

Doubly Linked List program using C language Operations : - Create List, insertion (beg, mid, end) deletion (beg, mid, end), Traverse #include<stdio.h> #include<conio.h>  void inst_beg();  void inst_mid();  void inst_end();  void del_beg();  void del_mid();  void del_end();  void traverse();  void reverse();  int count();  struct node  { int num;    struct node *next;    struct node *prev;  }*start=NULL,*last=NULL;  typedef struct node node;  typedef struct node* nptr;  void main()  { char choice;    while(1)    {    clrscr();    printf("-------LINKED LIST-------\n\n");    printf(" 1.Insertion at begining\n");    printf(" 2.Insertion at mid\n");    printf(" 3.Insertion at end\n");    printf(" 4.Deletion from begining\n");    printf(" 5.Deletion from mid\n")...