Skip to main content

The Fundamentals of Digital Marketing Certification

The Fundamentals of Digital Marketing Certification
Trying to make use of some spare time during these endless lockdowns. I completed The Fundamentals of Digital Marketing course on Google Digital Garage and got certified. This is not a great victory, nevertheless, I celebrate every small step towards a greater goal. #googlegarage #fundamentalsofdigitalmarketing #digitalmarketing

FDS 11

 Practical No: -11

Experiment No. 11: Queues are frequently used in computer programming, and a typical example is

the creation of a job queue by an operating system. If the operating system does not use priorities,

then the jobs are processed in the order they enter the system. Write C++ program for simulating job

queue. Write functions add job and delete job from queue.

Code:

using namespace std;

#include<iostream>

#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

#define SIZE 5

void enqueue(int x);

void dequeue();

void display();

int FRONT=-1;

int REAR=-1;

int QUEUE[SIZE];

main()

{

 int x,ch;

 while(1)

 {

 cout<<"\n 1:Add Job";

 cout<<"\n 2:Delete Job";

 cout<<"\n 3:Display";

 cout<<"\n 4:Exit";

 cout<<"\n Enter Your Choice:";

 cin>>ch;


 switch(ch)

 {

 case 1:

 cout<<"Enter Job:";

 cin>>x;

 enqueue(x);

 break;


 case 2:

 dequeue();

 break;


 case 3:

 display();

 break;


 case 4:

 exit(0);

 }

 }

 getch();

}

void enqueue(int x)

{

 if(REAR>=SIZE-1)

 cout<<"Queue is Overflow";

 else

 {

 REAR=REAR+1;

 QUEUE[REAR]=x;


 if(FRONT==-1)

 FRONT=0;

 }

}

void dequeue()

{

 if(FRONT==-1)

 cout<<"Queue is Underflow";

 else

 {

 cout<<"Deleted Element is:"<<QUEUE[FRONT];

 if(FRONT==REAR)

 {

 FRONT=-1;

 REAR=-1;

 }

 else

 {

 FRONT=FRONT+1;

 }

 }

}

void display()

{

 int i;

 if(FRONT==-1)

 cout<<"Queue is Empty \n";

 else

 {

 for(i=FRONT;i<=REAR;i++)

 cout<<""<<QUEUE[i];

 }


O/p 

add 11

delete 12

display

GALLERY

GALLERY
photos

ABOUT

HTML CSS, VB.net Developer and Java, C programming. With Loves Problem Solving and to Unreval the Mysteries behind the Magic of Computer Programming

Followers

MY PROJECTS

Popular posts from this blog

FDS 5

 Practical No: -5 Experiment No. 6: Write a python program to store first year percentage of students in array. Write function for sorting array of floating-point numbers in ascending order using a) Selection Sort b) Bubble sort and display top five score Code: # Function for Selection Sort of elements def Selection_Sort(marks):  for i in range(len(marks)):  # Find the minimum element in remaining unsorted array  min_idx = i  for j in range(i + 1, len(marks)):  if marks[min_idx] > marks[j]:  min_idx = j  # Swap the minimum element with the first element  marks[i], marks[min_idx] = marks[min_idx], marks[i]  print("Marks of students after performing Selection Sort on the list : ")  for i in range(len(marks)):  print(marks[i]) #<---------------------------------------------------------------------------------------> # Function for Bubble Sort of elements def Bubble_Sort(marks):  n = len(marks)  # Traverse throug...

FDS 4

 Practical No: -4 Experiment No. 4: a) Write a python program to store roll numbers of student in array who attended training program in random order. Write function for searching whether particular student attended training program or not, using linear search and sentinel search. b) Write a Python program to store roll numbers of student array who attended training program in sorted order. Write function for searching whether particular student attended training program or not, using Binary search and Fibonacci search. Code: import array as arr # Accept the Roll Numbers of the students def accept_roll():  a = arr.array('I', [])  no_stud = int(input("Enter the number of Students : "))  for i in range(0, no_stud):  a.append(int(input("Enter the Roll Number : ")))  return a # Print the Roll Numbers of the Students def print_roll(a):  for i in range(0, len(a)):  print("\t", a[i], end=" ")  print() # Linear Search def linear_search(a, x):  f...

Contact us

Name

Email *

Message *