#include < iostream >
using namespace std;
int main() {
char sender[50], receiver[50];
int i, winsize;
cout << "\nEnter the window size::";
cin >> winsize;
cout << "\nSender Window is Expanded to Store Message or Window::\n";
cout << "\nEnter the data to be Send::";
cin >> sender;
for (i = 0; i < winsize; i++)
receiver[i] = sender[i];
receiver[i] = NULL;
cout << "\nMessage Send by the Sender::";
cout << sender;
cout << "\nWindow Size of Receiver is Expanded::";
cout << "\nAcknowledgement from Receiver::";
for (i = 0; i < winsize; i++)
cout << "\nAck" << i;
cout << "\nMessage Received by Receiver is::";
cout << receiver;
cout << "\nWindow size of Receiver is Shrinked\n";
return 0;
}
Output::
Enter the window size::2
Sender Window is Expanded to Store Message or Window::
Enter the data to be Send::45
Message Send by the Sender::45
Window Size of Receiver is Expanded::
Acknowledgement from Receiver::
Ack0
Ack1
Message Received by Receiver is::45
Window size of Receiver is Shrinked