0
What's the mistake
Con.io is error https://code.sololearn.com/cHkjnRKObP53/?ref=app https://code.sololearn.com/cHkjnRKObP53/?ref=app
1 Odpowiedź
0
Conio.h isn't needed or ncessary. Most modern compilers don't even include it anymore.
Try this:
https://www.sololearn.com/compiler-playground/cFfIlUzP4ZQH
// Created by Narasimha Reddy
#include <stdio.h>
int front = 0, rear = 0;
int q[5];
int size = 5;
void insertion(int n) {
if (rear == size)
printf("Queue is full\n");
else {
q[rear] = n;
rear++;
}
}
void deletion() {
if (front == rear)
printf("Queue is empty\n");
else {
front++;
}
}
void display() {
if (front == rear) {
printf("Queue is empty\n");
} else {
for (int i = front; i < rear; i++)
printf("%d\n", q[i]);
}
}
int main() {
insertion(45);
insertion(55);
insertion(65);
insertion(75);
insertion(85);
deletion();
display();
return 0;
}
:::::OUTPUT:::::::
55
65
75
85