Active Oldest Votes. To find the matching pairs in columns, scan over each row except the last, and for each column, compare the value at array row col with the value at array row+1 col and report matches. To find the matching pairs in rows, scan over each column except the last, and for each row, compare the value at. This program demonstrates 2d parity check when data is sent through physical layer - srishab55/2d-Parity-Check. About Press Copyright Contact us Creators Advertise Developers Terms Privacy Policy & Safety How YouTube works Test new features Press Copyright Contact us Creators.
- A Web Development & Designing and programming code. Learn Wordpress tips and hacks From Videos and code in Description. Languages used are C, C, C#, PHP, Mysql for developing Websites, Computer Network Programs, Android, Data Structure Programs, Object-Oriented Programming and more Google me: 'Sahil Gulati Surat'.
- Posted by sahil gulati at 6:00:00 AM. Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest. Labels: 2D Parity check method, C, C, Computer Network, Data Structure, Programs, sahil gulati, Search engine Optimization (SEO), sg web solutions, social media marketing (SMM), Web Designing, web development, website.
Write a program to implement VRC method(Double-Parity Check)
#include
#include
#include
void main()
{
int a[20][20],ch,i,j,k,no,n,m,sum,re,r[50],flag=0;
clrscr();
do
{
printf('nVRC');
printf('n1.Sender n2.Receivern3.Exit');
printf('nEnter your choice:');
scanf('%d',&ch);
switch(ch)
{
case 1:
printf('Enter No. of Messages:');
scanf('%d',&n);
printf('nEnter the no. of bits for message:');
scanf('%d',&m);
for(i=0;i
{
printf('nEnter %d message=',i+1);
for(j=0;j
scanf('%d',&a[i][j]);
}
for(i=0;i
{
sum=0;
for(j=0;j
sum=sum+a[i][j];
a[i][j]=(sum%2);
}
for(i=0;i<=m;i++)
{
sum=0;
for(j=0;j
sum=sum+a[j][i];
a[j][i]=(sum%2);
}
printf('nMessage sent is :-n');
for(i=0;i<=n;i++)
{
for(j=0;j<=m;j++)
printf('%d ',a[i][j]);
printf(' ');
}
break;
case 2:
flag=0;
printf('Enter Number of bits for received message=');
scanf('%d',&re);
printf('nEnter The Received Message:-n');
for(i=0;i
scanf('%d',&r[i]);
printf('Enter Number of Messages=');
scanf('%d',&n);
m=re/(n+1);
k=0;
for(i=0;i<=n;i++)
{
for(j=0;j
{
a[i][j]=r[k];
k++;
}
}
for(i=0;i<=n;i++)
{
for(j=0;j
printf('%d ',a[i][j]);
printf('n');
}
for(i=0;i<=n;i++)
{
sum=0;
for(j=0;j
{
sum=sum+a[i][j];
}
if(sum%2!=0)
{
printf('nThere is an Error');
flag=1;
break;
}
}
if(flag!=1)
{
for(i=0;i
{
sum=0;
for(j=0;j<=n;j++)
{
sum=sum+a[j][i];
}
if(sum%2!=0)
{
printf('nThere is an Error');
flag=1;
break;
}
}
}
if(flag!=1)
printf('No Error');
break;
case 3: exit(0);
}
}while(1);
}
Output:
VRC
1.Sender
2.Receiver
3.Exit
Enter your choice:1
Enter No. of Messages:3
Enter the no. of bits for message:4
Enter 1 message=1 0 0 1
Enter 2 message=1 1 1 0
Enter 3 message=0 0 1 0
Message sent is :-
1 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0
Enter your choice:2
Enter Number of bits for received message=20
Enter The Received Message:-
1 0 0 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0
Enter Number of Messages=3
1 0 0 1 0
1 1 1 0 1
0 0 1 0 1
0 1 0 1 0
No Error
In this task, we need to implement a function that would check the number of parity using only the bit operations AND, OR, and NOT.
Solution
Note that the number x is odd only when the youngest (the first on the right) bit in its binary representation is equal to 1. Let us prove this. Recall the school rule of the algorithm for translation numbers from the binary system into the decimal. It is shown in the following picture:
We can take 2 out of the context for all terms except the last, which can be equal to either 1 or 0. Thus, if it is zero, then the sum will be in the form 2 (…) = x, then it will be divided by 2, and if it is equal to 1, then the amount will be in the form 2 (…) +1 = x, then it will not be divided by 2. This is the criterion of parity.
So we have proved the fact that the number is odd when the least significant bit is set to 1, and even when the least significant bit is 0. The question remains: how do you get the last bit of the number? Adoption: the last bit number x is equal to x & 1, where & is the bitwise AND. Why is this so? AND is equal to 1 only if both of its arguments are equal to 1. The number 1 in the binary system is as follows: … 000001 (depending on how many bit numbers we operate). So, for the bitmap AND for 1 with the result equal to number x all the bits, except the last, will be equal to zero, and the last bit will be equal to 1 if int the number x was equal to 1 (1 & 1 = 1), and 0 if int the number x was equal to 0 (0&1 = 0).
Thus, the value of the x&1 expression is 1 if it’s an odd number, and 0 if x is an even number.
2d Parity Check Program Cal
2d Parity Check Program Code
The sample about the parity check program in C that you have just examined was completed by a programmer from AssignmentShark. As a rule, we try to provide students with examples that can help them to solve difficult tasks, like our C++ regular expression example. Unfortunately, our samples are not very specific. Each task is unique and sometimes general samples can’t help you. If this is the case, you can order an original sample that will be completed just for you. Know how to do this by reading the next paragraph.
2d Parity Check Program In C
If you would like to make an order, you should fill the order form on our website. You need to specify the deadline, the discipline and the topic, as well as other details about the task. Afterward, you will submit the order form and our experts will examine it. The experts who are available at the moment and who are the most knowledgeable in the issue will offer you their prices. This option is paid because the sample will be written only for you. We won’t publish it. You’ll be the sole owner of the sample.
2d Parity Check Program Cost
2d Parity Check Program Compatibility
Our sample about a parity check program in C is only one from numerous samples that concern programming. You can look through other examples absolutely for free. We don’t establish prices for examples that are published. If you can’t find the specific sample, please, contact us! We are always ready to help you in your trying hour!