Posts

SUMMARY

This is the last blog of our series and we will like to conclude by this one.Till now we have completely implemented  the required software project.In this blog we would like to conclude the project by just giving a recap of what all we  have done.We would be sharing the complete code in a combined form so that you can refer it for your purpose. Let us see gather all the concepts and the functions that we have implemented in this complete project. 1.We successfully implemented the object oriented file handling concepts in the project and used it for creation and processing of our database which is a text file. 2.We implemented the respective functions of the admin. 3.We implemented the respective functions of the student user. 4.Basic data-structure like array,structure was used for the storing the database information from the text file. 5.Linear search was used for searching and quick sort was used for the sorting purpose used in the orderby() f...

ORDER BY PART-2

Image
This part of the blog is in continuation with ORDER BY PART-1 where we discussed the algorithm of quick sort. Now here we will see the code where it is applied to the program. Here if file is not in array then we call it to array first. Then we have two choices whether to sort by pages or by count. This choice will be passed as an argument to sorting(), where we will have a switch case. Arguments low and top are the end points of array for quick sort. If it is a valid array i.e. low<high then go to function parti() which returns the updated pivot element. sorting(low,pi-1,choice); is for left side of pivot. sorting(pi+1,high,choice); is for right part of pivot. Here according to choice we perform the algorithm on either pages or count attribute. Inside switch we select pivot element which is always the last element of array. In the above part of code, again according to the choice the algorithm proceeds. Swapping of array elements take place as per th...

ORDER BY PART-1

Image
ORDER BY IN SQL The order by statement in SQL is used to sort the stored data in either ascending or descending order. §        We have used sorting for the books on the parameters as no. of pages and no. of copies available of the book. For sorting Quick sort is used. §        Quick sort picks an element as pivot and partitions the given array around the picked pivot.     Partition Algorithm There can be many ways to do partition, following pseudo code adopts the method given in CLRS book. The logic is simple, we start from the leftmost element and keep track of index of smaller (or equal to) elements as i. While traversing, if we find a smaller element, we swap current element with arr[i]. Otherwise we ignore current element. Pseudo code for Partition partition (arr[], low, high) {     // pivot (Element to be placed at right position)     pivot...

GROUP BY

Image
In this blog we would like to perform the group by operation of sql in cpp.The group by operation helps in grouping the rows of a particular attribute having same values.This is one of the most important feature of sql.Let's code it down. Initially we will copy the data from the secondary memory to the primary memory using the copying function as discussed above. We are basically going to perform grouping by single attribute and the user would be given a choice to select the attribute by which he wants to perform the grouping operation.So here we provide the user with a small menu for selecting the attributes. The user enters his choice and it is stored in the choice variable.                      int choice;            cout<<endl<<"\nEnter the attribute by which you want to group the books ";            cout<<endl<<"\n1.Name\n2.Author\n3.Pu...

SEARCHING

Image
SEARCHING FUNCTION is used to find the query according to the NAME OF THE BOOK and NAME OF THE AUTHOR. First all the information is copied from CP.txt to the array YASH [] by using COPYING () function. For searching linear search is used. Linear search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched. In this case the loop will iterate until i<=top which is also can be considered as EOF (End Of File) Each name and author are checked ,once a proper argument is found then the information Name of the book, Name of Author, Publication, No of pages and no. of copies are displayed.