Sunday, 1 January 2017

Circular Queue

Program to implement a Curcular queue to accommodate the data from an array of structure


#include<iostream>

#include<process.h>

#define MAX 100

using namespace std;

//declaring the structure player


struct player{

int pid;

char pname[20];

};

//function to insert into the circular queue


void insert(player queue[], int &rear, int front, int value, char name[])

{


rear= (rear +1) % MAX; //positioning the rear to the next element




if(rear == front)

{

cout<<"The queue is full\n";

exit(0);

}

queue[rear].pid = value;

strcpy(queue[rear].pname,name);

}

//function to delete from the circular queue


void deleteQ(player queue[], int rear, int &front)

{

if(front == rear)

{

cout<<"The queue is empty\n";

exit(0);

}


front = (front + 1) % MAX; //positioning the front to remove the element




cout<<queue[front].pid<<" ";

cout<<queue[front].pname<<endl;

}

int main()

{

player queue[MAX];

int front,rear;


front=rear=0;//initializing the front and rear to point the first element




insert(queue,rear, front, 10,"Ashok");

insert(queue,rear, front, 20,"Ravi");

insert(queue,rear, front, 30,"Amit");

deleteQ(queue,rear, front);

deleteQ(queue,rear, front);

deleteQ(queue,rear, front);

}

Project File Details

Project File Outline

            i. Title Page

ii. Certificate of Project

iii. Table of Contents

1. Introduction and Background

1.1 Problem Statement

1.2 Hardware & Software 

1.3 Acknowledgement

2. Project Description

2.1 Functional Specification

2.1.1 Functions Performed

2.1.2 Limitations and Restrictions

2.1.3 User Interface Design [if required]

2.1.4 Other User Inputs [if required]

2.1.5 Other User Outputs [if required]

             3. References 
    a. Biblography
        1.books
        2.website
        3.Persons
 
 4. software in CD of softcopy

Computer Science Masking Scheme

Informatices Practices Study Materials for KV Ambikapur IP Students 2017.

Computer Science Study Materials for KV Ambikapur CS Students 2017.