Algo programmers
Відкрити в Telegram
join to share your code learning experience
Показати більшеКраїна не вказанаКатегорія не вказана
286
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 днів
Архів дописів
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int queue[100];
int n = 100, front = -1, rear = -1;
void empty() {
if (front == - 1 && rear == - 1) {
cout <<"the queue is empty\n";
} else {
cout<<"The queue is not empty\n";
}
}
void full() {
if (rear == n - 1) {
cout<<"The queue is full now\n";
}else{
cout<<"the queue is not full\n";
}
}
void peek() {
if ( front == -1 && rear == -1) {
cout<<"there is no element in the queue\n";
}else{
cout<<"The peek element is: "<<queue[rear]<<endl;
}
}
void enqueue(int element) {
if (rear = n-1) {
cout<<"OverFlow\n";
}else{
if (front == -1){
front = 0;
}
rear++;
queue[rear] = element;
}
}
void dequeue() {
if (front == -1 && rear == -1){
cout<<"Underflow\n";
}else if( front == rear) {
front = rear = -1;
}
else{
cout <<"The element deleted from the queue is: "<<queue[front];
front++;
}
}
void display() {
if (front == -1){
cout <<"The queue is empty.\n";
}else {
cout<<"The queue elements are: ";
for(int i=front; i <=rear; i++)
cout<<queue[i]<<" ";
cout<<endl;
}
}
int main() {
int choices;
cout <<"-------------MENU-------------\n";
cout <<"1) to check whether the queue is empty\n";
cout <<"2) to check whether the queue is full\n";
cout <<"3) to see the peeek element in the queue\n";
cout <<"4) to Enqueue an element to the queue\n";
cout <<"5) to dequeue an element from the queue\n";
cout <<"6) to display all elements of the queue\n";
cout <<"7) to exit\n";
cout<<"Enter your choice: \n";
cin>>choices;
do {
switch(choices){
case 1:
empty();
break;
case 2:
full();
break;
case 3:
peek();
break;
case 4:
int element;
cout<<"Enter element to the queue\n";
cin >> element;
enqueue(element);
break;
case 5:
dequeue();
break;
case 6:
display();
break;
case 7:
cout<<"BYE!";
exit(0);
break;
}
cout<<"Enter your choice: \n";
cin>>choices;
}while(choices != 7);
return 0;
}Repost from መርጌታ መንግስቱ
የነዚ ቤቶች ዕድለኞች እነማን ይሆን???? ቀኑ ደረሰ
የመጨረሻ ዙር @MIDROCINVESTMENT
ሚድሮክ ኢንቨስትመንት የመኖሪያ ቤት ሽልማት ሼር ፎርዋርድ ላደረጉ ለእድለኞች ሊያበረክት ነው የድርጅታችን ባለቤት የሆኑት ሼህ አላሙዲን( @ShiehAlamudi ) በወሰኑት ድርጅታችን በቴሌቪዢንና በሬድዮ ለማስታወቂያ ይመድበው የነበረውን በጣም ከፍተኛ ገንዘብ በመቀነስ የቴሌግራም ቻናል በመክፈት ራሱን እያስተዋወቀ ይገኛል!! ቴሌግራም ገፃችንን ብዙ ተከታይ እንዲያገኝ ፎርዋርድ(ሼር) ላደረጉ ተከታዮቻችን በሽልማት ለማንበሽበሽ ዝግጂቱን ጨርሷል;;
በመሆንም ይሄን መልዕክት ሼር ፎርዋርድ አድርጉ ተደራሽነቱን በበላይነት ላስፈፉ
1ኛ እጣ ባለ 3 መኝታ ከነሙሉ እቃው፡፡
2ኛ እጣ ባለ 2 መኝታ ከነሙሉ እቃው፡፡
3ኛ እጣ ባለ 1 መኝታ ከነሙሉ እቃው፡፡
4ኛ እና 5ኛ ለሚወጡ ባለ ሁለት እግር ተሽከርካሪ (ሞተር)
ቀጥሎ ላሉ 1000 እድለኞች የአመት ያልተገደበ የኢንተርኔት አገልግሎት ሽልማት ይኖረዋል፡፡ አሁንስ ምን ይጠብቃሉ ሊንኩን ተጭነው ከገቡ በሗላ
👉 t.me/midrocinvestment ይህን ፅሁፍ ለ60 እና ከዛ በላይ ወዳጂ ጓደኛዎ ግሩፕ ሼር ፎርዋርድ ያድርጉ የመሸለም እድሎ የሰፋ ነው ይህን የማይገኝ አጋጣሚ በከንቱ እንዳያሳልፉ አሁኑኑ ሼር ፎርዋርድ ያድርጉ ፡፡ ከ60 በላይ ሼር ፎርዋርድ ማረጋችሁ የመሸለም እድላችሁን ያሰፋዋል
♻️ ሼር ሲያረጉ እኛ ደሞ እንሸልሞታለን!!
✅ t.me/MIDROCINVESTMENT 👈ይቀላቀሉ
