Showing posts with label functions. Show all posts
Showing posts with label functions. Show all posts

Sunday, November 25, 2012

Program fifo and lru page replacement algorithm | Operating System


Code for first in first out as FIFO and Least Recently Used as LRU page replacement algorithm using structure in C programming with output | Operating System

Code for first in first out as FIFO and Least Recently Used as LRU page replacement algorithm using struture in C programming with output | Operating System

Thursday, September 27, 2012

Doubly Linked Lists Implementation using oops of c plus plus | Data Structure

Doubly Linked Lists Implementation using oops of c plus plus | Data Structure

Doubly Linked Lists Implementation using oops of c plus plus | Data Structure
By Sanjay Sinalkar
Write a program in c++ using object oriented concept to create Double Linklist which having following functionality 

1)Insert element at Begin
2)Insert element at given position
3)Insert element at End
4)Delete element from Begin
5)Delete element From End
6)Delete element from Given position
 7) Show all element Inserted in Display function()
Program should validate given position before calling given position operation such as Insert or Delete

Monday, September 17, 2012

Stack implementation in c++ code using array | Data Structure

Stack implementation in c++ code using array  | Data Structure

This program is the demonstration for implementing Simple Stack Program using array and Object Oriented Concept with basic functions of Stack push() and pop() with index called top which gives the current status of Stack! Stack has defined size so need two more function to check whether isEmpty() or isFull() to check stack is empty or not or is full or not. In this scenario top is integer type as default to top=-1,if top=-1 Mean Stack is Empty , if top=sizeOfStack-1 then stack is full.

Thursday, September 13, 2012

Virtual Function Implementation in C++ Programming

Virtual Function Implementation in C++ Programming

Question:
Write a base class called Employee. Use this class to store values name, salary etc.
Derive three specific classes called Manager, Teamleadand Programmer. Add to the
base class, a member function get_data() to initialize base class data members and
another function display() to compute and display information . Make display() as a
virtual function and redefine this function in the derived classes to suit their
requirements.

Friend Function Implementation in C++ Programming

Friend Function Implementation in C++ Programming

Questions:-
Create two classes DM and DB which store the value of distances. DM stores
distances in meters and centimeters and DB in feet and inches. Write a program
that can read values for the class objects and add one object of DM with another
object of DB. Use a friend function to carry out the addition operation. The object
that stores the results may be a DM or DB object, depending on the units in
which the results are required.
(Object Oriented Programming With C++ By Balaguruswamy)

Fibonacci series using Recursive Function C program

Fibonacci series using Recursive Function C program

Program to print the Fibonacci Series up to given term by using recursive Function in C program. Same Logic will be also work in C++ Programs also!

Sin Cos Function Implementation in C program

Sin Cos Functions Implementation in C program

Question :Write functions to calculate the sine and cosine of their input. Choose appropriate types for both argument and return value. The series (given below) can be used to approximate the answer. The function should return when the value of the final term is less than 0.000001 of the current value of the function.
sin x = x - pow(x,3)/fact(3) + pow(x,5)/fact(5)...
cos x = 1 - pow(x,2)/fact(2) + pow(x,4)/fact(4)...
Note the fact that the sign in front of each term alternates (--+--+--+...). pow(x,n) returns x to the nth power, fact(n) factorial of n (1 × 2 × 3 × ⋯ × n). You will have to write such functions. Check the results against published tables.(http://publications.gbdirect.co.uk/c_book/chapter4/exercises.html)