Posts

Some code cn

 //Bit stuffing #include<stdio.h> #include<string.h> void main() { int a[20],b[30],i,j,k,count,n; printf("Enter frame length:"); scanf("%d",&n); printf("Enter input frame (0's & 1's only):"); for(i=0;i<n;i++) scanf("%d",&a[i]); i=0;  count=1; j=0; while(i<n) { if(a[i]==1) { b[j]=a[i]; for(k=i+1;a[k]==1 && k<n && count<5;k++) { j++; b[j]=a[k]; count++; if(count==5) { j++; b[j]=0; } i=k; } } else { b[j]=a[i]; } i++; j++; } printf("After stuffing the frame is:"); for(i=0;i<j;i++) printf("%d",b[i]); } Output: Enter frame length:5 Enter input frame (0's & 1's only): 1 1 1 1 1 After stuffing the frame is: 111110 //Byte stuffing #include<stdio.h> #include<string.h> #include<conio.h> void main() { int j,l,m,c,k; char a[50],b[50]; printf("Enter the string:"); scanf("%s",a); strcpy(b,"DLESTX"); m=strlen(a); for(j=0;...

Char count

 #include<stdio.h> #include<string.h> char input[10][20]; int get_input(); void make_frames(int); int count_chars(int s); void main() { int no_of_words=get_input(); make_frames(no_of_words); } int get_input() { int answer; int i=0; do{ printf("\nEnter the Word:"); scanf("%s",input[i]); fflush(stdin); printf("\nDo you want to continue: (yes: 1 or no: 0)?:"); scanf("%d",&answer); i++; } while(answer!=0); return i; } void make_frames(int num_words){ int i=0; printf("\nThe Transmitted Data is:\n\t"); for(;i<num_words;i++) printf("%d%s",(count_chars(i)+1),input[i]); printf("\n\n"); } int count_chars(int index) { int i=0; while(input[index][i]!='\0') i++; return i; } Output: Enter the Word:cat Do you want to continue: (y: 1/n: 0)?:1 Enter the Word:dog Do you want to continue: (y: 1/n: 0)?:1 Enter the Word:apple Do you want to continue: (y: 1/n: 0)?:0 The Transmitted Data is: 4cat4dog6apple

Sema

 #include<stdio.h> #include<stdlib.h> int mutex=1,full=0,empty=3,x=0; int main() { int n; void producer(); void consumer(); int wait(int); int signal(int); printf("\n1.Producer\n2.Consumer\n3.Exit"); while(1) { printf("\nEnter your choice:"); scanf("%d",&n); switch(n) { case 1: if((mutex==1)&&(empty!=0)) producer(); else printf("Buffer is full!!"); break; case 2: if((mutex==1)&&(full!=0)) consumer(); else printf("Buffer is empty!!"); break; case 3: exit(0); break; } } return 0; } int wait(int s) { return (--s); } int signal(int s) { return(++s); } void producer() { mutex=wait(mutex); full=signal(full); empty=wait(empty); x++; printf("\nProducer produces the item %d",x); full=wait(full); empty=signal(empty); printf("\nConsumer consumes item %d",x); x--; mutex=signal(mutex); }

Fork

 #include<stdio.h> #include <unistd.h> #include<sys/types.h> int main() { int id,childid; id=getpid(); if((childid=fork())>0) { printf("\n i am in the parent process %d",id); printf("\n i am in the parent process %d",getpid()); printf("\n i am in the parent process %d\n",getppid()); } else { printf("\n i am in child process %d",id); printf("\n i am in the child process %d",getpid()); printf("\n i am in the child process %d",getppid()); }

Originals

 Welcome 

Terms & Conditions

 Terms & Conditions These terms and conditions applies to the Alpha app (hereby referred to as "Application") for mobile devices that was created by Alpha (hereby referred to as "Service Provider") as a Free service. Upon downloading or utilizing the Application, you are automatically agreeing to the following terms. It is strongly advised that you thoroughly read and understand these terms prior to using the Application. Unauthorized copying, modification of the Application, any part of the Application, or our trademarks is strictly prohibited. Any attempts to extract the source code of the Application, translate the Application into other languages, or create derivative versions are not permitted. All trademarks, copyrights, database rights, and other intellectual property rights related to the Application remain the property of the Service Provider. The Service Provider is dedicated to ensuring that the Application is as beneficial and efficient as possible. ...

App privacy policy

 Privacy Policy This privacy policy applies to the Alpha app (hereby referred to as "Application") for mobile devices that was created by Alpha (hereby referred to as "Service Provider") as a Free service. The Application does not gather precise information about the location of your mobile device. The Service Provider may use the information you provided to contact you from time to time to provide you with important information, required notices and marketing promotions. For a better experience, while using the Application, the Service Provider may require you to provide us with certain personally identifiable information. The information that the Service Provider request will be retained by them and used as described in this privacy policy.