The document describes an algorithm for vertical redundancy check (VRC) and longitudinal redundancy check (LRC) to detect errors in digital data transmission. The VRC program allows a user to choose the sender or receiver side to enter or receive a series of bits, calculate the parity, and check for errors. The LRC program similarly allows choosing the sender or receiver site to enter a 2D array of data, calculate a check sum, and detect errors. Both programs demonstrate common error detection techniques for digital communication.
Choosing the right way to process data might become a strategic and non trivial decision for many kind of applications. Especially in applications where an high percentage of the time is spent elaborating information behind the scenes.
There are different message queuing systems designed to manage and process data asynchronously. Using simple messages, it becomes possible to define many types of queue patterns, from the straightforward solution to the more complex one like routing, publisher/subscriber and topic.
The purpose of the talk is to show how to approach the different scenarios in php, adding value to your application.
Choosing the right way to process data might become a strategic and non trivial decision for many kind of applications. Especially in applications where an high percentage of the time is spent elaborating information behind the scenes.
There are different message queuing systems designed to manage and process data asynchronously. Using simple messages, it becomes possible to define many types of queue patterns, from the straightforward solution to the more complex one like routing, publisher/subscriber and topic.
The purpose of the talk is to show how to approach the different scenarios in php, adding value to your application.
Essential qualities found in intrapreneurseTailing India
Dear friends, after an inspiring and knowledgeable week spent on studying Women Entrepreneurs in India, we now move to our next topic. This week, we bring you the study on Intrapreneurs. Named as Intrapreneurs Week Series, it will be really beneficial for all those to be Intrapreneurs, Entrepreneurs and Corporate People across various fields. Today, in our 1st part of the series, we write about the Essential Qualities found in Intrapreneurs.
Deepening of flaws in startup india’s lawseTailing India
Around this time last year, the NarendraModi government launched the Startup India, Stand Up India campaign. Twelve months down the line, however, there has been very little forward movement. Only a handful of start-ups have bought into the plan, while the government is still struggling to get the nuts and bolts in place.
Startups- know 4 types of ip protection for businesseseTailing India
Copyrights protect original works of authorship, such as literature, music, artistic works, and computer software. As the holder of a copyright, you have the exclusive right to reproduce, adapt, and distribute the work. A copyright exists from the moment the work is created, so registration is voluntary.
However, registered works may be eligible for statutory damages and attorney’s fees in a copyright infringement suit, so it is recommended that you register at your local Copyright Office. You can register your copyright online by completing an application, and sending in a non-returnable copy of your work.
Customer Experience - Changing Shopping Experiences In India – End to End Bra...eTailing India
At the recently concluded eTailing India Expo 2017 – “India’s Flagship Conference & Exhibition on Retail, eCommerce and Mobile” (http://etailingindiaexpo.com), leading thought leaders shared their perspective on “Technology Services for Retail &eCommerce”. This article summarizes the session for Customer Experience: Changing Shopping Experiences in India – End to End Brand Experience.
Re-energeize your career by being an intrapreneureTailing India
A good intrapreneur is master at motivating people, creating innovative change and being incredibly honest with themselves and others.
Intrapreneurs approach work like an entrepreneur, but engage their internal team members and resources to uncover opportunities and solve problems across their own organization. In fact, the best intrapreneurs are passionate about driving innovation in areas beyond their primary job responsibility. It’s clear that employers benefit greatly from the spirit of initiative that intrapreneurs bring to an organization.
FDI To Aid Ecommerce Firms Expand Food And FMCG SectorseTailing India
Ten years after Amazon began the experiment with groceries at its Seattle home; the US e-commerce company is set to start selling farm produce, lentils and milk in India once it receives the government’s approval for its wholly-owned foods unit.
final Year Projects, Final Year Projects in Chennai, Software Projects, Embedded Projects, Microcontrollers Projects, DSP Projects, VLSI Projects, Matlab Projects, Java Projects, .NET Projects, IEEE Projects, IEEE 2009 Projects, IEEE 2009 Projects, Software, IEEE 2009 Projects, Embedded, Software IEEE 2009 Projects, Embedded IEEE 2009 Projects, Final Year Project Titles, Final Year Project Reports, Final Year Project Review, Robotics Projects, Mechanical Projects, Electrical Projects, Power Electronics Projects, Power System Projects, Model Projects, Java Projects, J2EE Projects, Engineering Projects, Student Projects, Engineering College Projects, MCA Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, Wireless Networks Projects, Network Security Projects, Networking Projects, final year projects, ieee projects, student projects, college projects, ieee projects in chennai, java projects, software ieee projects, embedded ieee projects, "ieee2009projects", "final year projects", "ieee projects", "Engineering Projects", "Final Year Projects in Chennai", "Final year Projects at Chennai", Java Projects, ASP.NET Projects, VB.NET Projects, C# Projects, Visual C++ Projects, Matlab Projects, NS2 Projects, C Projects, Microcontroller Projects, ATMEL Projects, PIC Projects, ARM Projects, DSP Projects, VLSI Projects, FPGA Projects, CPLD Projects, Power Electronics Projects, Electrical Projects, Robotics Projects, Solor Projects, MEMS Projects, J2EE Projects, J2ME Projects, AJAX Projects, Structs Projects, EJB Projects, Real Time Projects, Live Projects, Student Projects, Engineering Projects, MCA Projects, MBA Projects, College Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, M.Sc Projects, Final Year Java Projects, Final Year ASP.NET Projects, Final Year VB.NET Projects, Final Year C# Projects, Final Year Visual C++ Projects, Final Year Matlab Projects, Final Year NS2 Projects, Final Year C Projects, Final Year Microcontroller Projects, Final Year ATMEL Projects, Final Year PIC Projects, Final Year ARM Projects, Final Year DSP Projects, Final Year VLSI Projects, Final Year FPGA Projects, Final Year CPLD Projects, Final Year Power Electronics Projects, Final Year Electrical Projects, Final Year Robotics Projects, Final Year Solor Projects, Final Year MEMS Projects, Final Year J2EE Projects, Final Year J2ME Projects, Final Year AJAX Projects, Final Year Structs Projects, Final Year EJB Projects, Final Year Real Time Projects, Final Year Live Projects, Final Year Student Projects, Final Year Engineering Projects, Final Year MCA Projects, Final Year MBA Projects, Final Year College Projects, Final Year BE Projects, Final Year BTech Projects, Final Year ME Projects, Final Year MTech Projects, Final Year M.Sc Projects, IEEE Java Projects, ASP.NET Projects, VB.NET Projects, C# Projects, Visual C++ Projects, Matlab Projects, NS2 Projects, C Projects, Microcontroller Projects, ATMEL Projects, PIC Projects, ARM Projects, DSP Projects, VLSI Projects, FPGA Projects, CPLD Projects, Power Electronics Projects, Electrical Projects, Robotics Projects, Solor Projects, MEMS Projects, J2EE Projects, J2ME Projects, AJAX Projects, Structs Projects, EJB Projects, Real Time Projects, Live Projects, Student Projects, Engineering Projects, MCA Projects, MBA Projects, College Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, M.Sc Projects, IEEE 2009 Java Projects, IEEE 2009 ASP.NET Projects, IEEE 2009 VB.NET Projects, IEEE 2009 C# Projects, IEEE 2009 Visual C++ Projects, IEEE 2009 Matlab Projects, IEEE 2009 NS2 Projects, IEEE 2009 C Projects, IEEE 2009 Microcontroller Projects, IEEE 2009 ATMEL Projects, IEEE 2009 PIC Projects, IEEE 2009 ARM Projects, IEEE 2009 DSP Projects, IEEE 2009 VLSI Projects, IEEE 2009 FPGA Projects, IEEE 2009 CPLD Projects, IEEE 2009 Power Electronics Projects, IEEE 2009 Electrical Projects, IEEE 2009 Robotics Projects, IEEE 2009 Solor Projects, IEEE 2009 MEMS Projects, IEEE 2009 J2EE P
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);Joel Porquet
Guest-lecture given at UC Davis during my interview day in May of 2018.
Description: Using the printf() function is one of the very first steps every beginner learns when taking a programming class. It is also one of the most ubiquitous functions in software programs, across the many languages that define it. But how many programmers actually know how this common function works behind the scenes?
During this lecture, I will trace a brief history of printf(), delve into the nuts of bolts of a simple implementation through interactive coding, and branch out into interesting facts related to this function.
Problem Implement a FIFO program in which a client sends the server.pdffeelinggift
Problem: Implement a FIFO program in which a client sends the server 3 variable names
(strings). A valid variable name is defined for this assignment to be 6 characters or less,
consisting only of lower-case letters from a to \'z\', inclusive. The server checks the name for
validity, and if valid, it counts the number of in the variable name. Each of the original variable
names is sent back to the client, along with a message whether it is valid or invalid, and a count
of the number of letters in the indicating name that are vowels. Vowels, for those of you who
might have forgotten, are a, e, i, o and u Print the variable name, validity, and count of vowels on
the server side as well as on the client side after it has been received.
Please take a look and correct what I\'ve got below
/*------------------------------- Client -----------------------------------*/
#include
#include
#include
#include
#include
#include
#include
#include
main (void)
{
int fda;
int fdb;
struct program
{
char string1;
int good1;
int count1;
int status;
} data;
int rbyte, wbyte;
rbyte = 0;
wbyte = 0;
//Open Pathway to FIFO
if((fda = open(\"FIFOTOS\",O_WRONLY)) < 0){
printf(\"Can\'t open FIFOTOS to write\ \");
return;
}
if((fdb = open(\"FIFOFROMS\",O_RDONLY)) < 0){
printf(\"Can\'t open FIFOFROMS to read\ \");
return;
}
//Get input from user
printf(\"Client: Please enter first string: \");
scanf(\"%s\",&data.string1);
//Write data to FIFO
wbyte = write(fda,&data,sizeof(data));
//Check if write successfully
if (wbyte <= 0)
{
printf(\"Client: Can\'t write data to server\");
}
else
{
printf(\"Client: Write &d byte to server\ \");
//Read data from server
rbyte = read(fdb,&data,sizeof(data));
if(rbyte <=0)
{
printf(\"Client: Can\'t read from server\ \");
}
else
{
printf(\"Client: %d byte read from server\ \",rbyte);
if(data.status >=0)
{
printf(\"String : %s\",data.string1);
printf(\"\ Validity : %c\",(data.good1 =1 ? \'Y\' : \'N\'));
printf(\"\ Count of Vowels : %d\",data.count1);
}
else
{
printf(\"Client: Error\");
}
}
}
printf(\"All Done\ \");
close(fda);
close(fdb);
}
/*------------------------------------------ Server ------------------------------------------*/
#include
#include
#include
#include
#include
#include
#include
#include
main (void)
{
int fda;
int fdb;
int i;
struct program
{
char string1;
int good1;
int count1;
int status;
} data;
int rbyte, wbyte;
rbyte = 0;
wbyte = 0;
//Create the FIFO and open pathway
if((mkfifo(\"FIFOTOS\",0666) < 0 && errno != EEXIST)){
perror(\"Can\'t create FIFOTOS\");
exit(-1);
}
if((mkfifo(\"FIFOFROMS\",0666) < 0 && errno != EEXIST)){
perror(\"Can\'t create FIFOFROMS\");
exit(-1);
}
if((fdb = open(\"FIFOTOS\",O_RDONLY)) < 0){
printf(\"Can\'t open FIFOTOS to write\ \");
return;
}
if((fda = open(\"FIFOFROMS\",O_WRONLY)) < 0){
printf(\"Can\'t open FIFOFROMS to read\ \");
return;
}
//Read data from client
rbyte = read(fdb, &data, sizeof(data));
//Check if read successfully
if (rbyte <= 0)
{
printf(\"No byte read from Client\ \");
}
els.
Essential qualities found in intrapreneurseTailing India
Dear friends, after an inspiring and knowledgeable week spent on studying Women Entrepreneurs in India, we now move to our next topic. This week, we bring you the study on Intrapreneurs. Named as Intrapreneurs Week Series, it will be really beneficial for all those to be Intrapreneurs, Entrepreneurs and Corporate People across various fields. Today, in our 1st part of the series, we write about the Essential Qualities found in Intrapreneurs.
Deepening of flaws in startup india’s lawseTailing India
Around this time last year, the NarendraModi government launched the Startup India, Stand Up India campaign. Twelve months down the line, however, there has been very little forward movement. Only a handful of start-ups have bought into the plan, while the government is still struggling to get the nuts and bolts in place.
Startups- know 4 types of ip protection for businesseseTailing India
Copyrights protect original works of authorship, such as literature, music, artistic works, and computer software. As the holder of a copyright, you have the exclusive right to reproduce, adapt, and distribute the work. A copyright exists from the moment the work is created, so registration is voluntary.
However, registered works may be eligible for statutory damages and attorney’s fees in a copyright infringement suit, so it is recommended that you register at your local Copyright Office. You can register your copyright online by completing an application, and sending in a non-returnable copy of your work.
Customer Experience - Changing Shopping Experiences In India – End to End Bra...eTailing India
At the recently concluded eTailing India Expo 2017 – “India’s Flagship Conference & Exhibition on Retail, eCommerce and Mobile” (http://etailingindiaexpo.com), leading thought leaders shared their perspective on “Technology Services for Retail &eCommerce”. This article summarizes the session for Customer Experience: Changing Shopping Experiences in India – End to End Brand Experience.
Re-energeize your career by being an intrapreneureTailing India
A good intrapreneur is master at motivating people, creating innovative change and being incredibly honest with themselves and others.
Intrapreneurs approach work like an entrepreneur, but engage their internal team members and resources to uncover opportunities and solve problems across their own organization. In fact, the best intrapreneurs are passionate about driving innovation in areas beyond their primary job responsibility. It’s clear that employers benefit greatly from the spirit of initiative that intrapreneurs bring to an organization.
FDI To Aid Ecommerce Firms Expand Food And FMCG SectorseTailing India
Ten years after Amazon began the experiment with groceries at its Seattle home; the US e-commerce company is set to start selling farm produce, lentils and milk in India once it receives the government’s approval for its wholly-owned foods unit.
final Year Projects, Final Year Projects in Chennai, Software Projects, Embedded Projects, Microcontrollers Projects, DSP Projects, VLSI Projects, Matlab Projects, Java Projects, .NET Projects, IEEE Projects, IEEE 2009 Projects, IEEE 2009 Projects, Software, IEEE 2009 Projects, Embedded, Software IEEE 2009 Projects, Embedded IEEE 2009 Projects, Final Year Project Titles, Final Year Project Reports, Final Year Project Review, Robotics Projects, Mechanical Projects, Electrical Projects, Power Electronics Projects, Power System Projects, Model Projects, Java Projects, J2EE Projects, Engineering Projects, Student Projects, Engineering College Projects, MCA Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, Wireless Networks Projects, Network Security Projects, Networking Projects, final year projects, ieee projects, student projects, college projects, ieee projects in chennai, java projects, software ieee projects, embedded ieee projects, "ieee2009projects", "final year projects", "ieee projects", "Engineering Projects", "Final Year Projects in Chennai", "Final year Projects at Chennai", Java Projects, ASP.NET Projects, VB.NET Projects, C# Projects, Visual C++ Projects, Matlab Projects, NS2 Projects, C Projects, Microcontroller Projects, ATMEL Projects, PIC Projects, ARM Projects, DSP Projects, VLSI Projects, FPGA Projects, CPLD Projects, Power Electronics Projects, Electrical Projects, Robotics Projects, Solor Projects, MEMS Projects, J2EE Projects, J2ME Projects, AJAX Projects, Structs Projects, EJB Projects, Real Time Projects, Live Projects, Student Projects, Engineering Projects, MCA Projects, MBA Projects, College Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, M.Sc Projects, Final Year Java Projects, Final Year ASP.NET Projects, Final Year VB.NET Projects, Final Year C# Projects, Final Year Visual C++ Projects, Final Year Matlab Projects, Final Year NS2 Projects, Final Year C Projects, Final Year Microcontroller Projects, Final Year ATMEL Projects, Final Year PIC Projects, Final Year ARM Projects, Final Year DSP Projects, Final Year VLSI Projects, Final Year FPGA Projects, Final Year CPLD Projects, Final Year Power Electronics Projects, Final Year Electrical Projects, Final Year Robotics Projects, Final Year Solor Projects, Final Year MEMS Projects, Final Year J2EE Projects, Final Year J2ME Projects, Final Year AJAX Projects, Final Year Structs Projects, Final Year EJB Projects, Final Year Real Time Projects, Final Year Live Projects, Final Year Student Projects, Final Year Engineering Projects, Final Year MCA Projects, Final Year MBA Projects, Final Year College Projects, Final Year BE Projects, Final Year BTech Projects, Final Year ME Projects, Final Year MTech Projects, Final Year M.Sc Projects, IEEE Java Projects, ASP.NET Projects, VB.NET Projects, C# Projects, Visual C++ Projects, Matlab Projects, NS2 Projects, C Projects, Microcontroller Projects, ATMEL Projects, PIC Projects, ARM Projects, DSP Projects, VLSI Projects, FPGA Projects, CPLD Projects, Power Electronics Projects, Electrical Projects, Robotics Projects, Solor Projects, MEMS Projects, J2EE Projects, J2ME Projects, AJAX Projects, Structs Projects, EJB Projects, Real Time Projects, Live Projects, Student Projects, Engineering Projects, MCA Projects, MBA Projects, College Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, M.Sc Projects, IEEE 2009 Java Projects, IEEE 2009 ASP.NET Projects, IEEE 2009 VB.NET Projects, IEEE 2009 C# Projects, IEEE 2009 Visual C++ Projects, IEEE 2009 Matlab Projects, IEEE 2009 NS2 Projects, IEEE 2009 C Projects, IEEE 2009 Microcontroller Projects, IEEE 2009 ATMEL Projects, IEEE 2009 PIC Projects, IEEE 2009 ARM Projects, IEEE 2009 DSP Projects, IEEE 2009 VLSI Projects, IEEE 2009 FPGA Projects, IEEE 2009 CPLD Projects, IEEE 2009 Power Electronics Projects, IEEE 2009 Electrical Projects, IEEE 2009 Robotics Projects, IEEE 2009 Solor Projects, IEEE 2009 MEMS Projects, IEEE 2009 J2EE P
printf("%s from %c to Z, in %d minutes!\n", "printf", 'A', 45);Joel Porquet
Guest-lecture given at UC Davis during my interview day in May of 2018.
Description: Using the printf() function is one of the very first steps every beginner learns when taking a programming class. It is also one of the most ubiquitous functions in software programs, across the many languages that define it. But how many programmers actually know how this common function works behind the scenes?
During this lecture, I will trace a brief history of printf(), delve into the nuts of bolts of a simple implementation through interactive coding, and branch out into interesting facts related to this function.
Problem Implement a FIFO program in which a client sends the server.pdffeelinggift
Problem: Implement a FIFO program in which a client sends the server 3 variable names
(strings). A valid variable name is defined for this assignment to be 6 characters or less,
consisting only of lower-case letters from a to \'z\', inclusive. The server checks the name for
validity, and if valid, it counts the number of in the variable name. Each of the original variable
names is sent back to the client, along with a message whether it is valid or invalid, and a count
of the number of letters in the indicating name that are vowels. Vowels, for those of you who
might have forgotten, are a, e, i, o and u Print the variable name, validity, and count of vowels on
the server side as well as on the client side after it has been received.
Please take a look and correct what I\'ve got below
/*------------------------------- Client -----------------------------------*/
#include
#include
#include
#include
#include
#include
#include
#include
main (void)
{
int fda;
int fdb;
struct program
{
char string1;
int good1;
int count1;
int status;
} data;
int rbyte, wbyte;
rbyte = 0;
wbyte = 0;
//Open Pathway to FIFO
if((fda = open(\"FIFOTOS\",O_WRONLY)) < 0){
printf(\"Can\'t open FIFOTOS to write\ \");
return;
}
if((fdb = open(\"FIFOFROMS\",O_RDONLY)) < 0){
printf(\"Can\'t open FIFOFROMS to read\ \");
return;
}
//Get input from user
printf(\"Client: Please enter first string: \");
scanf(\"%s\",&data.string1);
//Write data to FIFO
wbyte = write(fda,&data,sizeof(data));
//Check if write successfully
if (wbyte <= 0)
{
printf(\"Client: Can\'t write data to server\");
}
else
{
printf(\"Client: Write &d byte to server\ \");
//Read data from server
rbyte = read(fdb,&data,sizeof(data));
if(rbyte <=0)
{
printf(\"Client: Can\'t read from server\ \");
}
else
{
printf(\"Client: %d byte read from server\ \",rbyte);
if(data.status >=0)
{
printf(\"String : %s\",data.string1);
printf(\"\ Validity : %c\",(data.good1 =1 ? \'Y\' : \'N\'));
printf(\"\ Count of Vowels : %d\",data.count1);
}
else
{
printf(\"Client: Error\");
}
}
}
printf(\"All Done\ \");
close(fda);
close(fdb);
}
/*------------------------------------------ Server ------------------------------------------*/
#include
#include
#include
#include
#include
#include
#include
#include
main (void)
{
int fda;
int fdb;
int i;
struct program
{
char string1;
int good1;
int count1;
int status;
} data;
int rbyte, wbyte;
rbyte = 0;
wbyte = 0;
//Create the FIFO and open pathway
if((mkfifo(\"FIFOTOS\",0666) < 0 && errno != EEXIST)){
perror(\"Can\'t create FIFOTOS\");
exit(-1);
}
if((mkfifo(\"FIFOFROMS\",0666) < 0 && errno != EEXIST)){
perror(\"Can\'t create FIFOFROMS\");
exit(-1);
}
if((fdb = open(\"FIFOTOS\",O_RDONLY)) < 0){
printf(\"Can\'t open FIFOTOS to write\ \");
return;
}
if((fda = open(\"FIFOFROMS\",O_WRONLY)) < 0){
printf(\"Can\'t open FIFOFROMS to read\ \");
return;
}
//Read data from client
rbyte = read(fdb, &data, sizeof(data));
//Check if read successfully
if (rbyte <= 0)
{
printf(\"No byte read from Client\ \");
}
els.
I just need code for processQueue function using iterators from the .pdfallurafashions98
I just need code for processQueue function using iterators from the linkedList class.
#include
#include
#include
#include
#include "Queuecpp.h"
#include "Songcpp.h"
#include "RequestCpp.h"
void populateRequests(Queue& q);
void populateSongDataBase(LinkedList &list);
void processQueue(LinkedList &list,Queue& q);
void processRequest(std::string action, std::string title,std::string singer,int chartPos);
//GIVEN
int main() {
LinkedList list;
Queue q;
populateSongDataBase(list); // fill the Songs Data Base into Linked List
std::cout<<"*************************************\n";
list.printList(); //
std::cout<<"*************************************\n";
populateRequests(q); // fill the request q
std::cout<<"\n";
std::cout<<"---------------PRINTING QUEUE-------------------\n";
q.printList();
std::cout<<"------------------------------------\n";
processQueue(list,q); // process the requests
std::cout<<"*************************************\n";
list.printList();
std::cout<<"*************************************\n";
}
//GIVEN
//Requires an empty linked list
//Effects fills the list with request by reading from the RequestData.txt
//Modifies the queue by filling it
void populateRequests(Queue &q){
}
//GIVEN
//Requires Filled data base , song to play
//Effects Finds song using get, if found plays it
//Modifies nothing
std::string playSong(LinkedList&list, Song s){
if (list.get(s)>=0){
return "PLAYING :"+ s.toString()+"\n";
}
else{
return "SONG NOT FOUND\n";
}
}
//GIVEN
//Requires filled database
//Effects calls print methood to print top ten songs
//Modifies nothing
void printTopTenSongs(LinkedList& list){
std::cout<<"PLAYING TOP TEN SONG __________\n";
list.print(10);
;
}
//Requires filled Song Database, a Song to add. The chart position given in the song is where it
will get added. Note this is a Song that is not supposed to exist in database.
//Effects adds the song from its original chart position
//Modifies the Song database. Adjust chart position of all Songs affected by this addition- this
adjustment is done in insert method using adjustPosition method. If the Process Queue adds a
Song that already is in the database, then a duplicate entry can occur.
//TODO
void addThisSong(LinkedList &list, Song s){
//TODO
/* Use this code
if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){
/* Use this code
if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT
"< &list, Song s, int pos){
int chartPos=list.get(s);
std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int
chartPos){
Song s(title,singer,chartPos);
char ch =action[0];
switch(ch){
case 'P' : std::cout< &list ,Queue& q){
int requestNumber=1;
//Create an iterator for the Queue to iteratate through requests
std::cout<<"-------------------------------------------------------------------------\n";
// call processRequest
std::cout<<"-------------------------------------------------------------------------\n"
std::cout<<"------------------------.
2. printf("nnINVALID ENTRY!!!");
}
}
}
void receiver()
{
int sum=0;
printf("nEnter the number of bits you want (Max 20) : ");
scanf("%d",&j);
printf("nnEnter %d bits : ",j);
for(i=0;i<j;i++)
{
printf("nn %d bit: ",i+1);
scanf("%d",&data[i]);
if((data[i]!=0) && (data[i]!=1))
{
printf("nInvalid Bit......Enter only (1's and 0's) ");
i--;
}
}
for(i=0;i<j;i++)
{
sum=sum+data[i];
}
printf("n-------------------------------------------------------------------------n");
printf("ttttOutput");
printf("n-------------------------------------------------------------------------");
printf("nnThe Number of 1's in the message is: %d",sum);
if(sum%2==0)
{
printf("nnThere is no ERROR in the message.");
}
else
{
printf("nnThere is ERROR in the message.");
}
}
void sender()
{
int sum=0;
printf("nEnter the number of bits you want (Max 20) : ");
scanf("%d",&j);
printf("nEnter %d bits : ",j);
for(i=0;i<j;i++)
2
3. {
printf("nn %d bit: ",i+1);
scanf("%d",&data[i]);
if((data[i]!=0) && (data[i]!=1))
{
printf("nInvalid bit......Enter only (1's and 0's) ");
i--;
}
}
for(i=0;i<j;i++)
{
sum=sum+data[i];
}
printf("n-------------------------------------------------------------------------n");
printf("ttttOutput");
printf("n-------------------------------------------------------------------------");
printf("nnThe Message sent was : ");
for(i=0;i<j;i++)
{
printf("%d",data[i]);
}
if(sum%2!=0)
{
printf("nnParity Bit is : 1");
data[j]=1;
printf("nnThe Message after appending parity bit was : ");
for(i=0;i<=j;i++)
{
printf("%d",data[i]);
}
}
else
{
printf("nnParity Bit is : 0");
data[j]=0;
printf("nnThe Message after appending parity bit was : ");
for(i=0;i<=j;i++)
{
printf("%d",data[i]);
}
}
}
3
4. OUTPUT:-
****************** VERTICAL REDUNDANCY CHECK *******************
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Side
2. Receiver's Side
3. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Sender's Side
-----------------------------------------------------------------------------------------------------------
-
Enter the number of bits you want (Max 20) : 5
Enter 5 bits :
1 bit: 1
2 bit: 0
3 bit: 1
4 bit: 0
5 bit: 1
-----------------------------------------------------------------------------------------------------------
-
4
5. Output
-----------------------------------------------------------------------------------------------------------
-
The Message sent was : 10101
Parity Bit is : 1
The Message after appending parity bit was : 101011
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Side
2. Receiver's Side
3. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Receiver's Side
-----------------------------------------------------------------------------------------------------------
-
Enter the number of bits you want (Max 20) : 4
Enter 4 bits :
1 bit: 1
2 bit: 0
3 bit: 2
Invalid Bit......Enter only (1's and 0's)
5
6. 3 bit: 0
4 bit: 1
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
The Number of 1's in the message is: 2
There is no ERROR in the message.
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Side
2. Receiver's Side
3. Exit
Enter Your Choice : 3
6
10. if((a[i][j]!=0)&&(a[i][j]!=1))
{
printf("nnInvalid Bit......Enter another bit(Only 1's
and 0's)!!!");
j--;
}
}
}
printf("n-------------------------------------------- Output
----------------------------------------n");
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
if(a[j][i]==1)
{
count++;
}
}
if(count%2==0)
{
count1++;
count=0;
}
else
{
count=0;
}
}
if(count1==n)
printf("nData is correctly received...n");
else
printf("nData is not correctly received...n");
}
10
11. OUTPUT:-
***************** LONGITUDINAL REDUNDANCY CHECK ***************
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Sender's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the number of rows and columns max(5) : 2 3
Enter 2 rows and 3 columns :
Enter 1 row 3 bits : 1 0 0
Enter 2 row 3 bits : 1 0 1
11
12. ----------------------------------------------- Output --------------------------------------------------
The parity row is :
0 0 1
The Message after appending :
1 0 0
1 0 1
0 0 1
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Receiver's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the number of rows and columns max(5) : 2 3
Enter 2 rows and 3 columns :
Enter 1 row 3 bits : 1 1 0
12
13. Enter 2 row 3 bits : 1 0 1
------------------------------------------------ Output -------------------------------------------------
Data is not correctly received...
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 3
13
20. {
printf("nnThe Message is not received correctly");
}
}
Output:-
********************** CYCLIC REDUNCDANCY CHECK ****************
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 1
----------------------------------------------- Sender's Site
-------------------------------------------
20
21. Enter total number of data bits : 5
Enter 5 data bits :
Enter bit 1: 1
Enter bit 2: 0
Enter bit 3: 1
Enter bit 4: 1
Enter bit 5: 0
Enter size of Key (! >databits) : 3
Enter Key values :
Enter key bit 1 : 1
Enter key bit 2 : 1
Enter key bit 3 : 0
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
The Message : 1011000
The Divisor : 110
Intermediate CRC : 011 001 010 010 010
The Final CRC Bit is : 10
The Message transmitted is : 1011010
-----------------------------------------------------------------------------------------------------------
-
21
22. MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 2
---------------------------------------------- Receiver's Site -----------------------------------------
Enter total number of data bits: 5
Enter 5 data bits :
Enter bit 1 : 1
Enter bit 2 : 1
Enter bit 3 : 0
Enter bit 4 : 1
Enter bit 5 : 1
Enter size of Key (! >databits): 3
Enter Key values :
Enter key bit 1 : 1
Enter key bit 2 : 0
Enter key bit 3 : 1
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
22
23. The Message : 11011
The Divisor : 101
CRC's : 011 010 000 000 000
The Final CRC is : 00
The Message is received correctly
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 3
-4- CHECKSUM
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int sum(int,int);
int sum1(int,int,int);
void sender();
void receiver();
int a[8],b[8],r[8],c[8],r1[8];
23
24. static int carry=0;
int n,i,count=0;
void main()
{
int choice;
clrscr();
printf("n*********************************** CHECKSUM
*********************************n");
while(1)
{
printf("nn--------------------------------------------------------------------------
n");
printf("ttttMAIN MENU");
printf("n--------------------------------------------------------------------------n
n");
printf("Choice No. Choice Name.nn");
printf(" 1. Sender's Sitenn 2. Receiver's Sitenn 3.
ExitnnnEnter Your Choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("-------------------------------------------------------------
-----------n");
printf("ntt Sender's Site ");
printf("n-----------------------------------------------------------
-------------n");
sender();
break;
case 2:
printf("-------------------------------------------------------------
-----------n");
printf("nttReceiver's Site ");
printf("n-----------------------------------------------------------
-------------n");
receiver();
break;
case 3:
exit(1);
default:
printf("nnINVALID ENTRY");
}
}
24
25. }
void sender()
{
printf("nEnter the total number of bits : ");
scanf("%d",&n);
printf("nEnter %d bits of Data 1 : nn",n);
for(i=0;i<n;i++)
{
printf("nEnter bit %d: ",i+1);
scanf("%d",&a[i]);
if(a[i]!=0 && a[i]!=1)
{
printf("nnInvalid Bit......Enter another value(only 1's and
0's)!!!!!");
i--;
}
}
printf("n------------------------------------------------------------------n");
printf("nEnter %d bits of Data 2 : nn",n);
for(i=0;i<n;i++)
{
printf("nEnter bit %d: ",i+1);
scanf("%d",&b[i]);
if(b[i]!=0 && b[i]!=1)
{
printf("nnInvalid Bit......Enter another value(only 1's and
0's)!!!!!");
i--;
}
}
printf("n-----------------------------------------------------------------------------n");
printf("nttOutput");
printf("n-----------------------------------------------------------------------------n");
printf("nnData 1:ttt ");
for(i=0;i<n;i++)
{
printf("%d",a[i]);
}
printf("nnData 2:ttt ");
for(i=0;i<n;i++)
{
printf("%d",b[i]);
}
for(i=n;i>=0;i--)
{
25
32. 1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Sender's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the total number of bits : 5
Enter 5 bits of Data 1 :
Enter bit 1: 1
Enter bit 2: 0
Enter bit 3: 1
Enter bit 4: 1
Enter bit 5: 0
-----------------------------------------------------------------------------------------------------------
-
Enter 5 bits of Data 2 :
Enter bit 1: 0
Enter bit 2: 1
Enter bit 3: 0
Enter bit 4: 0
Enter bit 5: 1
-----------------------------------------------------------------------------------------------------------
-
32
33. Output
-----------------------------------------------------------------------------------------------------------
-
Data 1: 10110
Data 2: 01001
Result : 11111
1's Compliment of Result :00000
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Receiver's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the total number of bits : 5
Enter 5 bits of Data 1 :
Enter bit 1: 0
Enter bit 2: 0
Enter bit 3: 0
Enter bit 4: 0
33
34. Enter bit 5: 1
-----------------------------------------------------------------------------------------------------------
-
Enter 5 bits of Data 2 :
Enter bit 1: 1
Enter bit 2: 2
Invalid Bit......Enter another value(only 1's and 0's)!!!!!
Enter bit 2: 1
Enter bit 3: 1
Enter bit 4: 1
Enter bit 5: 0
-----------------------------------------------------------------------------------------------------------
-
Enter 5 bits of Checksum :
Enter bit 1: 0
Enter bit 2: 0
Enter bit 3: 0
Enter bit 4: 0
Enter bit 5: 0
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
Data 1: 00001
34
35. Data 2: 11110
Checksum: 00000
Result : 11111
1's Compliment of Result :00000
Data is ERROR free, hence ACCEPTED...
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 3
35
39. printf("%d ",data[i]);
}
void receiver()
{
int data[20],temp;
printf("nEnter the number of data bits : ");
scanf("%d",&m);
for(i=0;i<20;i++)
data[i]=0;
printf("nEnter %d data bits : ",m);
for(i=1;i<=m;i++)
{
scanf("%d",&data[i]);
if (data[i]!=0&&data[i]!=1)
{
printf("Invalid Entry!!! Enter only 0's and 1's");
i--;
}
}
for(i=1;i<=m;i++)
{
if(i==1)
{
count=data[1]+data[3]+data[5]+data[7]+data[9]+data[11];
if(count%2==0)
{
data[i]=data[i];
}
else
{
count1=count1+i;
}
}
if(i==2)
{
count=data[2]+data[3]+data[6]+data[7]+data[10]+data[11];
if(count%2==0)
{
data[i]=data[i];
}
else
{
39
40. count1=count1+i;
}
}
if(i==4)
{
count=data[4]+data[5]+data[6]+data[7];
if(count%2==0)
{
data[i]=data[i];
}
else
{
count1=count1+i;
}
}
if(i==8)
{
count=data[8]+data[9]+data[10]+data[11];
if(count%2==0)
{
data[i]=data[i];
}
else
{
count1=count1+i;
}
}
}
printf("nn-----------------------------------------------------------------------------n");
printf("ttOutputn");
printf("n--------------------------------------------------------------------------------n");
if(count1>0)
{
if(count1>m)
{
printf("nError Is At Position %d",count1);
printf("nnOOPS!!! Position is not availablen");
}
else
{
printf("nError Is At Position %d",count1);
if(data[count1]==0)
data[count1]=1;
else
data[count1]=0;
printf("nCorrect Code Word : ");
40
41. for(i=1;i<=m;i++)
{
printf("%d ",data[i]);
}
}
}
else
{
printf("nReceived Data Is ERROR FREE... n");
printf("nCorrect Code Word : ");
for(i=1;i<=m;i++)
{
printf("%d ",data[i]);
}
}
}
41
42. Output:-
***************************** HAMMING CODE *************************
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Sender's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the number of data bits (MAX 11) : 7
The Parity Bits are : 4
Enter 7 data bits : 1 0 0 1 0 1 1
Data Is : 4 4 1 4 0 0 1 4 0 1 1
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
42
43. New Data To Be Sent Is : 1 0 1 1 0 0 1 0 0 1 1
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Receiver's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the number of data bits : 11
Enter 11 data bits : 1 0 1 1 0 0 1 0 1 1 1
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
Error Is At Position 9
Correct Code Word : 1 0 1 1 0 0 1 0 0 1 1
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
43
44. 1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 3
-6- BIT STUFFING
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void sender();
void receiver();
int data[20],i,j,n,count=0;
void main()
{
int choice;
clrscr();
printf("********************************** BIT STUFFING
********************************");
while(1)
{
printf("nn--------------------------------------------------------------------------
n");
printf("ttttMAIN MENU");
printf("n--------------------------------------------------------------------------n
n");
printf("Choice No. Choice Name.nn");
printf(" 1. Sender's Sitenn 2. Receiver's Sitenn 3.
ExitnnnEnter Your Choice : ");
scanf("%d",&choice);
44
45. switch(choice)
{
case 1:
printf("n-----------------------------------------------------------
--------------n");
printf("ttt Sender's Site");
printf("n-----------------------------------------------------------
--------------n");
sender();
break;
case 2:
printf("n-----------------------------------------------------------
--------------n");
printf("ttt Receiver's Site");
printf("n-----------------------------------------------------------
--------------n");
receiver();
break;
case 3:
exit(1);
default:
printf("nInvalid Choice!!!");
}
}
}
void sender()
{
printf("nEnter the length of your code : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("nEnter %d bit : ",i+1);
scanf("%d",&data[i]);
}
printf("nnThe Original Data entered : ");
for(i=0;i<n;i++)
{
printf("%d ",data[i]);
}
i=0;
while(i<n)
{
if(data[i]==1)
{
i++;
45
48. Output:-
****************************** BIT STUFFING **************************
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Sender's Site
-----------------------------------------------------------------------------------------------------------
-
48
49. Enter the length of your code : 11
Enter 1 bit : 0
Enter 2 bit : 1
Enter 3 bit : 1
Enter 4 bit : 1
Enter 5 bit : 1
Enter 6 bit : 1
Enter 7 bit : 1
Enter 8 bit : 0
Enter 9 bit : 1
Enter 10 bit : 1
Enter 11 bit : 0
The Original Data entered : 0 1 1 1 1 1 1 0 1 1 0
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
Data After Stuffing : 0 1 1 1 1 1 0 1 0 1 1 0
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
49
50. 3. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Receiver's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the length of your code : 11
Enter 1 bit : 0
Enter 2 bit : 1
Enter 3 bit : 1
Enter 4 bit : 1
Enter 5 bit : 1
Enter 6 bit : 1
Enter 7 bit : 0
Enter 8 bit : 0
Enter 9 bit : 1
Enter 10 bit : 0
Enter 11 bit : 1
The Original Data entered : 0 1 1 1 1 1 0 0 1 0 1
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
Data After De-Stuff : 0 1 1 1 1 1 0 1 0 1
-----------------------------------------------------------------------------------------------------------
-
50
55. Output:-
************** CHIPPING SEQUENCE USING WALSH MATRIX ***********
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Station No.
1. Station 1
55
56. 2. Station 2
3. Station 4
4. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Station 1
-----------------------------------------------------------------------------------------------------------
-
Your Code For Station 1 : 1
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Station No.
1. Station 1
2. Station 2
3. Station 4
4. Exit
Enter Your Choice : 5
Invalid Entry!!!
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Station No.
56
57. 1. Station 1
2. Station 2
3. Station 4
4. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Station 2
-----------------------------------------------------------------------------------------------------------
-
Your Code For Station 2 :
1 1
1 -1
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Station No.
1. Station 1
2. Station 2
3. Station 4
4. Exit
Enter Your Choice : 3
57
58. -----------------------------------------------------------------------------------------------------------
-
Station 4
-----------------------------------------------------------------------------------------------------------
-
Your Code For Station 4 :
1 1 1 1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 1
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Station No.
1. Station 1
2. Station 2
3. Station 4
4. Exit
Enter Your Choice : 4
58
59. -8- BIT COMPRESSION
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[20],cnt1,cnt2,n;
clrscr();
printf("n************************** BIT COMPRESSION
************************************n");
printf("nnEnter the length of Data ( <= 20 ) : ");
scanf("%d",&n);
printf("nnEnter %d Bits : n",n);
for(i=1;i<=n;i++)
{
printf("nnEnter Bit %d:",i);
scanf("%d",&a[i]);
}
printf("nnOriginal Data : ");
for(i=1;i<=n;i++)
{
printf("%d ",a[i]);
}
cnt1=0;
cnt2=0;
printf("nn-----------------------------------------------------------------------------n");
printf("ttt Output");
printf("n-------------------------------------------------------------------------------n");
printf("nThe Data Contains : n");
for(i=1;i<=n;i++)
{
if(a[i]==1)
{
if(cnt2!=0)
{
printf("nn 0's : %d",cnt2);
cnt2=0;
}
cnt1++;
}
59
61. Output:-
************************** BIT COMPRESSION **************************
Enter the length of Data : 11
Enter 11 Bits :
Enter Bit 1 : 1
Enter Bit 2 : 1
Enter Bit 3 : 0
Enter Bit 4 : 0
Enter Bit 5 : 0
Enter Bit 6 : 0
Enter Bit 7 : 1
Enter Bit 8 : 1
Enter Bit 9 : 0
Enter Bit 10 : 1
Enter Bit 11 :1
Original Data : 1 1 0 0 0 0 1 1 0 1 1
-----------------------------------------------------------------------------------------------------------
-
Output
-----------------------------------------------------------------------------------------------------------
-
The Data Contains :
1's : 2
0's : 4
61
63. printf("ttt Receiver's Site");
printf("n-----------------------------------------------------------
--------------n");
receiver();
break;
case 3:
exit(1);
default:
printf("nnInvalid Entry");
}
}
}
void sender()
{
int i,n;
char *ptr,*str,*str1;
printf("nEnter the Plain Text : ");
scanf("%s",str);
printf("nEnter the Charter difference : ");
scanf("%d",&n);
printf("n-----------------------------------------------------------------------nn");
printf("nPlain Text : ");
printf("%s",str);
printf("nnCipher Text After Encryption : ");
for(i=0;str[i]!='0';i++)
{
if((str[i]>=65 && str[i]<=90-n) || (str[i]>=97 && str[i]<=122-n))
{
ptr[i]=str[i]+n;
}
else if((str[i]>90-n && str[i]<=90)||(str[i]>122-n && str[i]<=122))
{
ptr[i]=str[i]-26+n;
}
else
{
ptr[i]=str[i];
}
}
ptr[i]='0';
printf("%s",ptr);
}
63
64. void receiver()
{
int i,n;
char *ptr,*str,*str1;
printf("nEnter the Cipher text : ");
scanf("%s",ptr);
printf("nEnter the Charter difference : ");
scanf("%d",&n);
printf("n-----------------------------------------------------------------------nn");
printf("nCipher Text : ");
printf("%s",ptr);
printf("nnPlain text After Decryption : ");
for(i=0;ptr[i]!='0';i++)
{
if((ptr[i]>=65+n && ptr[i]<=90) || (ptr[i]>=97+n && ptr[i]<=122))
{
str1[i]=ptr[i]-n;
}
else if((ptr[i]>=65 && ptr[i]<=65+n)||(ptr[i]>=97 && ptr[i]<=97+n))
{
str1[i]=ptr[i]+26-n;
}
else
{
str1[i]=ptr[i];
}
}
str1[i]='0';
printf("%s",str1);
}
64
65. Output:-
********************* MONOALPHABETIC ENCRYPTION ****************
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 1
-----------------------------------------------------------------------------------------------------------
-
Sender's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the Plain Text : TARANNUM
Enter the Charter difference : 5
-----------------------------------------------------------------------------------------------------------
-
Plain Text : TARANNUM
Cipher Text After Encryption : YFWFSSZR
65
66. -----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
3. Exit
Enter Your Choice : 2
-----------------------------------------------------------------------------------------------------------
-
Receiver's Site
-----------------------------------------------------------------------------------------------------------
-
Enter the Cipher text : yfwfsszr
Enter the Charter difference : 5
-----------------------------------------------------------------------------------------------------------
-
Cipher Text : yfwfsszr
Plain text After Decryption : tarannum
-----------------------------------------------------------------------------------------------------------
-
MAIN MENU
-----------------------------------------------------------------------------------------------------------
-
Choice No. Choice Name.
1. Sender's Site
2. Receiver's Site
66
67. 3. Exit
Enter Your Choice : 3
-10- POLYALPHABETIC ENCRYPTION
#include <stdio.h>
#include <string.h>
void main()
{
unsigned int i,j=1,k;
char input[257],key[33],l[257];
clrscr();
k=65;
printf("n************************** POLYALPHABETIC
ENCRYPTION ***************************n");
printf("ntttt VIGENERE TABLE nn");
printf("------------------------------------------------------------------------------nn");
while (j <= 26)
{
for (i=j; i<j+26; i++)
{
if (k >90)
k = k - 26;
printf("%c ",k );
k++;
}
printf("n");
67
69. Output:-
********************* POLYALPHABETIC ENCRYPTION *****************
VIGENERE TABLE
-----------------------------------------------------------------------------------------------------------
-
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
69
70. Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
Z A B C D E F G H I J K L M N O P Q R S T U V W X Y
-----------------------------------------------------------------------------------------------------------
-
Enter Plain Text : HIWORLD
Enter Encryption Key : ME
-----------------------------------------------------------------------------------------------------------
-
KEY : MEMEMEM
Plain Text : HIWORLD
Cipher Text : TMISDPP
70
72. for(i=0;i<e;i++)
c=c*m%n;
c=c%n;
printf("nEncrypted Plain Text : %d",c);
printf("nn----------------------------------------------------------------------n");
}
void decrypt()
{
int i;
m = 1;
for(i=0;i< d;i++)
m=m*c%n;
m = m%n;
printf("nDecrypted Cipher Text : %d",m);
}
void main()
{
int p,q,s;
clrscr();
printf("n************************* RSA ALGORITHM
*****************************nn");
printf("nEnter Two Relative Prime Numbers : ");
scanf("%d%d",&p,&q);
n = p*q;
phi=(p-1)*(q-1);
printf("nF(n)t = %d",phi);
do
{
printf("nnEnter value for e : ");
scanf("%d",&e);
check();
}while(flg==1);
d = 1;
do
{
s = (d*e)%phi;
d++;
}while(s!=1);
d = d-1;
printf("n-----------------------------------------------------------------------------nn");
printf("nPublic Keyt: {%d,%d}",e,n);
printf("nnPrivate Keyt: {%d,%d}",d,phi);
printf("nn---------------------------------------------------------------------------nn");
printf("nEnter The Plain Text : ");
72
73. scanf("%d",&m);
encrypt();
printf("nnEnter the Cipher text : ");
scanf("%d",&c);
decrypt();
getch();
}
Output:-
**************************** RSA ALGORITHM *************************
Enter Two Relative Prime Numbers : 7 11
F(n) = 60
Enter value for e : 13
-----------------------------------------------------------------------------------------------------------
-
Public Key : {13,77}
Private Key : {37,60}
-----------------------------------------------------------------------------------------------------------
-
Enter The Plain Text : 7
Encrypted Plain Text : 35
73
78. Output:-
********************** DIJKSTRA'S SHORTEST PATH *******************
Enter number of vertices : 6
Enter edge 1(0 0 to quit) : 1 2
Enter weight for this edge : 6
Enter edge 2(0 0 to quit) : 2 5
Enter weight for this edge : 3
Enter edge 3(0 0 to quit) : 2 6
Enter weight for this edge : 2
Enter edge 4(0 0 to quit) : 3 4
78
79. Enter weight for this edge : 2
Enter edge 5(0 0 to quit) : 3 6
Enter weight for this edge : 3
Enter edge 6(0 0 to quit) : 4 6
Enter weight for this edge : 1
Enter edge 7(0 0 to quit) : 5 4
Enter weight for this edge : 4
Enter edge 8(0 0 to quit) : 6 5
Enter weight for this edge : 3
Enter edge 9(0 0 to quit) : 0 0
The adjacency matrix is :
0 6 0 0 0 0
0 0 0 0 3 2
0 0 0 2 0 3
0 0 0 0 0 1
0 0 0 4 0 0
0 0 0 0 3 0
Enter source node(0 to quit) : 1
Enter destination node(0 to quit) : 6
Shortest distance is : 8
Shortest Path is : 1->2->6
Enter source node(0 to quit) : 2
Enter destination node(0 to quit) :4
79
80. Shortest distance is : 7
Shortest Path is : 2->5->4
Enter source node(0 to quit) : 0
Enter destination node(0 to quit) : 0
-13-PRIM’S ALGORITHM
#include<stdio.h>
#include<conio.h>
#define MAX 10
#define TEMP 0
#define PERM 1
#define FALSE 0
#define TRUE 1
#define infinity 9999
struct node
{
int predecessor;
int dist;
int status;
};
80
81. struct edge
{
int u;
int v;
};
int adj[MAX][MAX];
int n;
main()
{
int i,j;
int path[MAX];
int wt_tree,count;
struct edge tree[MAX];
clrscr();
printf("********* MINIMUM SPANNING TREE FROM PRIM'S
ALGORITHM ********n");
create_graph();
printf("nAdjacency matrix is : nn");
display();
count = maketree(tree,&wt_tree);
printf("nWeight of spanning tree is : %dn", wt_tree);
printf("nEdges to be included in spanning tree are : nn");
for(i=1;i<=count;i++)
{
printf("%d->",tree[i].u);
printf("%dn",tree[i].v);
}
getch();
}
create_graph()
{
int i,max_edges,origin,destin,wt;
printf("nEnter number of vertices : ");
scanf("%d",&n);
max_edges=n*(n-1)/2;
for(i=1;i<=max_edges;i++)
{
printf("nEnter edge %d(0 0 to quit) : ",i);
81
82. scanf("%d %d",&origin,&destin);
if((origin==0) && (destin==0))
break;
printf("nEnter weight for this edge : ");
scanf("%d",&wt);
if( origin > n || destin > n || origin<=0 || destin<=0)
{
printf("nInvalid edge!n");
i--;
}
else
{
adj[origin][destin]=wt;
adj[destin][origin]=wt;
}
}
if(i<n-1)
{
printf("nSpanning tree is not possiblen");
exit(1);
}
}
display()
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
printf("%3d",adj[i][j]);
printf("n");
}
}
int maketree(struct edge tree[MAX],int *weight)
{
struct node state[MAX];
int i,k,min,count,current,newdist;
int m;
int u1,v1;
*weight=0;
for(i=1;i<=n;i++)
{
state[i].predecessor=0;
state[i].dist = infinity;
state[i].status = TEMP;
82
84. return FALSE;
return TRUE;
}
Output:-
******** MINIMUM SPANNING TREE FROM PRIM'S ALGORITHM ********
Enter number of vertices : 7
Enter edge 1(0 0 to quit) : 1 2
Enter weight for this edge : 3
Enter edge 2(0 0 to quit) : 1 3
Enter weight for this edge : 10
Enter edge 3(0 0 to quit) : 1 4
Enter weight for this edge : 2
Enter edge 4(0 0 to quit) : 1 5
84
85. Enter weight for this edge : 4
Enter edge 5(0 0 to quit) : 2 5
Enter weight for this edge : 7
Enter edge 6(0 0 to quit) : 3 4
Enter weight for this edge : 12
Enter edge 7(0 0 to quit) : 3 6
Enter weight for this edge : 15
Enter edge 8(0 0 to quit) : 4 5
Enter weight for this edge : 6
Enter edge 9(0 0 to quit) : 4 6
Enter weight for this edge : 4
Enter edge 10(0 0 to quit) : 5 6
Enter weight for this edge : 5
Enter edge 11(0 0 to quit) : 5 7
Enter weight for this edge : 2
Enter edge 12(0 0 to quit) : 6 7
Enter weight for this edge : 3
Enter edge 13(0 0 to quit) : 0 0
Adjacency matrix is :
0 3 10 2 4 0 0
3 0 0 0 7 0 0
10 0 0 12 0 15 0
2 0 12 0 6 4 0
4 7 0 6 0 5 2
0 0 15 4 5 0 3
0 0 0 0 2 3 0
85
86. Weight of spanning tree is : 24
Edges to be included in spanning tree are :
1->4
1->2
1->5
5->7
7->6
1->3
86