Posts

Write a command line program for line editor of practcal slip

/*     slip-7 1. Write a command line program for line editor. The file to be edited is taken  as command line argument, an empty  file is opened for editing if no argument  is supplied.  It should display '$' prompt to accept the line editing commands. Implement the following commands. i)    a                 - to append ii)    i  n                 - to insert after nth line iii)    c    n1   n2              - to copy line n1 at  n2 position iv)    c    n1, n2    n3   - to copy range of line at n3        [30 marks] */ #include<stdio.h> #include<conio.h> #include<string.h> #define new...

RoundRobin Program of practical slip

 /* Implementation of RoundRobin method for CPU scheduling using Circular LL */   #include<stdlib.h> #define newnode (struct node *)malloc(sizeof(struct node)) struct node { int jobno,time;   struct node *next; }*JOBQ=NULL; void erase() { struct node *S,*T;   if(JOBQ!=NULL)   { for(T=JOBQ;T->next!=JOBQ; T=T->next) ;  // go to last node     T->next=NULL;     while(JOBQ!=NULL)  { S=JOBQ;  JOBQ=JOBQ->next;  free(S);  }   } } void CreateJOBQ() { struct node *S;   int i,n;   printf("\nHow many jobs?"); scanf("%d",&n);   if(JOBQ!=NULL) erase(JOBQ);   JOBQ=newnode;   printf("\nEnter JOB No. & execution time in sec. "); scanf("%d %d",&JOBQ->jobno,&JOBQ->time);   S=JOBQ;   for(i=2;i<=n;i++)   { S->next=newnode;     S=S->next;     printf("\nEnter JOB No. & execution time in sec. ")...