-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.c
More file actions
28 lines (23 loc) · 1 KB
/
Main.c
File metadata and controls
28 lines (23 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// This code the transmission and reception of a message using a hypothetical communication protocol called "Simplex Stop-and-Wait Protocol".
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "Sender.c"
#include "Receiver.c"
int main() {
srand(time(0)); // Seed for random values
char message[1000]; // Assuming message size not exceeding 1000 characters
double errorProb;
printf("\n******************************************************************************\n");
printf("---> Enter the message to transmit: ");
scanf("%[^\n]s", message);
printf("---> Enter the error probability (0 to 1): ");
scanf("%lf", &errorProb);
printf("/n---> Sender transmitting the message:\n");
sender(message, strlen(message), errorProb);
printf("\n---> Receiver receiving the message:\n");
receiver(errorProb);
printf("******************************************************************************\n");
return 0;
}