The MIT License
Copyright (c) 2005 by the Rakesh R and Nanda Kishor K N
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in
the Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of
the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
|
|
Lab
:
C Programmming
|
|
Lab Program #1
-
Write a C program to find the area of a triangle,
given three sides. [area=sqr(s*(s-a)*(s-b)*(s-c)) where s=a+b+c/2]
|
labc_01.c
|
|
Lab Program #2
- Write a C program to find the area of a
circle, given radius. [area=pi* r*r]
|
labc_02.c
|
|
Lab Program #3
- Write a C program to find the simple interest, given principle,
rate of interest and time. [si=(p*t*r)/100]
|
labc_03.c
|
|
Lab Program #4
- Write a C program to check whether a given number is odd or even.
|
labc_04.c
|
|
Lab Program #5
- Write a C program to check whether a given integer number is
positive or negative.
|
labc_05.c
|
|
Lab Program #6
- Write a C program to find biggest of three numbers.
|
labc_06.c
|
|
Lab Program #7
- Write a C program to find and output all the roots of a given
quadratic equation, for non-zero coefficients. In case of errors,
your program should report suitable error message.
|
labc_07.c
|
|
Lab Program #8
- Write a C program to simulate a simple calculate that performs
arithmetic operations like addition, subtraction, multiplication,
and division only on integers. Error message should be reported,
if any attempt is made to divide by zero. [Use switch statements]
|
labc_08.c
|
|
Lab Program #9
- Write a C program to find the sum of first 'N' natural numbers.
|
labc_09.c
|
|
Lab Program #10
- Write a C program to generate and print first 'N' FIBONACCI numbers.
|
labc_10.c
|
|
Lab Program #11
- Write a C program to find the GCD and
LCM of 2 integer numbers and output the results along with the given integers.
[Use Euclid algorithm.]
|
labc_11.c
|
|
Lab Program #12
- Write a C program to find the sum of odd numbers and sm of even numbers from 1 to N.
Output the computed sums on two different lines with suitable heading.
|
labc_12.c
|
|
Lab Program #13
- Write a C program to reverse a given integer number and check
whether it is a palindrome or not. Output the given number with
suitable message.
|
labc_13.c
|
|
Lab Program #14
- Write a C program to find value sin(x) using series.
|
labc_14.c
|
|
Lab Program #15
- Write a C program to find value of cos(x) using the
series.
|
labc_15.c
|
|
Lab Program #16
-
Write a C program to find whether a given is prime or not and output
the given number with suitable message.
|
labc_16.c
|
|
Lab Program #17
- Write a C program to generate and print prime number in a given range.
Also print the prime number.
|
labc_17.c
|
Lab Program #18
- Write a C program to read N integers into an array A and to
1. find the sum of negative numbers.
2. find the sum of positive numbers.
3. find the average of all input numbers.
output the various results computed with proper headings.
|
labc_18.c
|
|
Lab Program #19
- Write a C program to input N numbers and store them in an array.
Conduct a linear search for a given key number and report success
or failure in the form of a suitable message.
|
labc_19.c
|
|
Lab Program #20
- Write a C program to sort N numbers i ascending order using bubble sort
and print both the given array and sorted array with suitable heading.
|
labc_20.c
|
|
Lab Program #21
- Write a C program to accept N numbers in ascending order and to search
for a given number using binary search. Report success or failure in the form
of suitable messages.
|
labc_21.c
|
|
Lab Program #22
- Write a C program to input N real numbers and to find
mean, variance and standard deviation.
|
labc_22.c
|
|
Lab Program #23
- Write a C program to evaluate the given polynomial.
|
labc_23.c
|
|
Lab Program #24
- Write a C program to read two matrices
A(M*N) and B(M*N) and perform addition or subtraction of A and
B, Find trace of the resultant matrix. Output the given
matrices their sum or difference and the trace.
|
labc_24.c
|
|
Lab Program #25
- Write a C program to read a matrix A(m*n),
Find the transpose of the given matrix and output both the input
matrix and the transposed matrix.
|
labc_25.c
|
|
Lab Program #26
- Write a C program to read a string and check whether it is a palindrome or not. Output
the given string also with suitable messages.
|
labc_26.c
|
|
Lab Program #27
- Write a C program to read TWO strings and
concatenate them without using the built-in functions.
|
labc_27.c
|
|
Lab Program #28
- Write a C program to read a sentence and replace lowercase
character by uppercase and vice versa. Output the given
sentence as well as the case converted sentence on two different lines.
|
labc_28.c
|
|
Lab Program #29
- Write a C program to read a sentence and count the number of vowels
and consonants in the given sentence. Output the results on two with
suitable headings.
|
labc_29.c
|
Lab Program #30
- Write a C program to read N names, store them in the form of an array and
sort them in alphabetical order. Output the given names and the sorted
names with suitable headings.
|
labc_30.c
|
Lab Program #31
- Write a C program to sort given N elements by selection sort method
using function
1. To find the position of minimum elements in an array,
2. To swap the contents of two positions
|
labc_31.c
|
Lab Program #32
- Develop functions
1. To read a given matrix
2. To output a matrix
3. To compute the product of two matrices
use the above developed functions to read into two matrices
A(m*n) and B(p*q) to compute the product of the input
matrices as well as to output the given matrices and the computed product matrix in a main function.
|
labc_32.c
|
Lab Program #33
- Write a C program to read a matrix a(m*n) and to find the following
using functions
1. sum of elements of each row
2. sum of elements of each column
3. find the sum of all the elements of the matrix output the computed results with suitable headings.
|
labc_33.c
|
|
Lab Program #34
- Write a C program to read two integers M and N, and to swap their
values, Use a user defined function for swapping. output the values of M and N
before and after swapping with suitable message.
|
labc_34.c
|
|
Lab Program #35
- Write a C program to read N integers and store them in an
array A and find the sum all these elements using pointer.
Output the given array and the computed sum suitable heading
|
labc_35.c
|
|
|
|
Lab
:
Data Structures with C Programmming
|
|
Lab Program #1
|
lab_p01.c
|
|
Lab Program #2
|
lab_p02.c
|
|
Lab Program #3
|
lab_p03.c
|
|
Lab Program #4
|
lab_p04.c
|
|
Lab Program #5
|
lab_p05.c
|
|
Lab Program #6
|
lab_p06.c
|
|
Lab Program #7
|
lab_p07.c
|
|
Lab Program #8
|
lab_p08.c
|
|
Lab Program #9
|
lab_p09.c
|
|
Lab Program #10
|
lab_p10.c
|
|
Lab Program #11
|
lab_p11.c
|
|
Lab Program #12
|
lab_p12.c
|
|
Lab Program #13a
|
lab_p13a.c
|
|
Lab Program #13b
|
lab_p13b.c
|
|
Lab Program #14
|
lab_p14.c
|
|
|
|
Lab
:
ADA - Advanced Data Structures & Algorithms
|
|
Lab Program #1
- Perform recursive Binary search and
Linear search. Hence find the time required to search an element.
|
bsearch.cpp
|
|
lsearch.cpp
|
|
Lab Program #2
- Sort a given set of elements using the Heapsort method.
|
heapsort.cpp
|
|
Lab Program #3a
- Sort a given set of elements using Merge sort method.
Lab Program #3b
- Check whether a given graph is connected or not using
DFS method.
|
msort.cpp
|
|
graphcon.cpp
|
|
Lab Program #4
- Sort a given set of elements using Selection sort and hence find the time required to sort elements.
|
selectsort.cpp
|
|
Lab Program #5a
- Obtain the Topological ordering of
vertices in a given Digraph.
Lab Program #5b
- Sort a given set of elements using Insertion
sort method.
|
topologicalsort.cpp
|
|
insertsort.cpp
|
|
Lab Program #6
- Implement 0/1 Knapsack problem using
Dynamic Programming.
|
knapsack.cpp
|
|
Lab Program #7
- From a given vertex in a weighted connected graph, find shortest paths to other
vertices using Dijkstra’s algorithm.
|
dijkstra.cpp
|
|
Lab Program #8
- Sort a given set of elements using Quick sort method.
|
qsort.cpp
|
|
Lab Program #9
- Find Minimum Cost Spanning Tree of a given undirected graph using
Kruskal’s algorithm.
|
kruskal.cpp
|
|
Lab Program #10a
- Print all the nodes reachable from a given starting node in a digraph using
Breadth First Search method.
Lab Program #10b
- Implement All Pair Shortest paths problem using
Floyd’s algorithm.
|
bfs.cpp
|
|
floyd.cpp
|
|
Lab Program #11
- Find a subset of a given set S = {s1, s2,…,sn} of n positive integers whose sum is equal to a given positive integer d.
For example, if S = {1, 2, 5, 6, 8} and d = 9, there are two solutions {1, 2, 6} and {1, 8}. A suitable message is to be displayed if the given problem instance doesn’t have a solution.
|
subset.cpp
|
|
Lab Program #12a
- Implement Horspool algorithm for String Matching.
Lab Program #12b
- Find the Binomial Co-efficient using
Dynamic Programming.
|
horspool.cpp
|
|
bincoefficient.cpp
|
|
Lab Program #13
- Find Minimum Cost Spanning Tree of a given undirected graph using
Prim’s algorithm.
|
prim.cpp
|
|
Lab Program #14a
- Print all the nodes reachable from a given starting node in a given digraph using
Depth First Search method.
Lab Program #14b
- Compute the Transitive closure of a given directed graph using
Warshall’s algorithm.
|
dfs.cpp
|
|
warshall.cpp
|
|
Lab Program #15
- Implement N Queen’s problem using Back Tracking.
|
nqueens.cpp
|
|
|
|
Lab
:
Computer Graphics
Note
: Make necessary changes to the <path>
in the statement
initgraph(&gd,&gm,"<path>");
to
point to the Turbo C BGI files location in your system.
|
Lab Program #1
- Program to implement the following using built-in functions available in the library
:
1. Kite flying
2. Bar Graph
3. Spiral Model
4. Fish Movement
5. Rotation of wheel
6. Moving car
|
lab_cg01.cpp
|
|
Lab Program #2
- Write a program to implement the midpoint line algorithm
to generate a line with any slope and thickness. Implement the
poly line command using this algorithm as a routine that display
the set of straight lines between the 'n' input points. For n=1the routine displays a single point.
|
lab_cg02.cpp
|
Lab Program #3
- Write a program to display a line graph using Midpoint
line algorithm. The input to the program is a set of data corresponding to the X and Y
axes. Data pairs are to be
displayed as asterisk(*) joined according to the input
specification.
|
lab_cg03.cpp
|
|
Lab Program #4
- Write a program to implement midpoint circle drawing
algorithm. Modify the algorithm to implement specified arc or sector.
|
lab_cg04.cpp
|
Lab Program #5
- Write a program to draw a rectangle using built in
function and perform the following operations :
1. Rotation about origin followed by translation.
2. Rotation about arbitrary point.
3. Apply X-shear & y-Shear on rectangle.
|
lab_cg05.cpp
|
Lab Program #6
- Write a Program to create a house like figure and perform
the following operations :
1. Scaling with respect to Origin.
2. Scaling with respect to arbitrary point.
3. Reflect about the line y=mx + c.
|
lab_cg06.cpp
|
|
Lab Program #7
- Write a program to implement the Cohen-Sutherland clipping
algorithm. Make provision to specify the input line,
window for clipping and view port for displaying the clipped image.
(Use built in line and rectangle function)
|
lab_cg07.cpp
|
|
Lab Program #8
- Write a program to implement a Bazier curve for the
given set of control points.
|
lab_cg08.cpp
|
|
Lab Program #9
- Write a program to implement 3-D rotation with respect to
z-axis (wire frame model of a cube). Use appropriate data
structure to manipulate the wire frame model.
|
lab_cg09.cpp
|
|
Lab Program #10
- Write a program to fill a triangle using
scan-line area filling algorithm. (Use appropriate data
structures.)
|
lab_cg10.cpp
|
|
|
|
Lab
:
OOPS with C++ Programmming
|
|
Lab Program #1
-
A C++ PROGRAM TO CREATE A CLASS CALLED COMPLEX AND IMPLEMENT ADDITION OF COMPLEX NUMBERS BY OVERLOADING THE FUNCTION "ADD" WHICH RETURNS
THE COMPLEX NUMBER.
|
lab_cpp01.cpp
|
Lab Program #2
-
PROGRAM TO CREATE A LINKED-LIST WITH
INSERT-FRONT, DELETE-FRONT AS MEMBER FUNCTIONS BY CREATING THE OBJECTS.
|
lab_cpp02.cpp
|
|
Lab Program #4
-
PROGRAM TO IMPLEMENT STACK OPERATION IN C++ BY OVERLOADING OPERATORS '+' & '-' & DISPLAY RESULTS BY OVERLOADING THE OPERATOR '<<'
|
lab_cpp04.cpp
|
|
Lab Program #5
-
A C++ PROGRAM TO CREATE A CLASS CALLED DATE TO ADD & SUBTRACT TWO VALID DATES.
|
lab_cpp05.cpp
|
|
Lab Program #6
-
PROGRAM TO PERFORM ADDITION & SUBTRACTION OF MATRICES AFTER CHECKING THEIR COMPATIBILITY TO DO SO BY OVERLOADING '+' & '-'
|
lab_cpp06.cpp
|
|
Lab Program #7
-
A C++ PROGRAM TO CREATE A CLASS OCTAL TO PERFORM DECIMAL TO OCTAL CONVERSION & ADDITION OF AN OCTAL & AN INTEGER BY OVERLOADING '+'&'=='.
|
lab_cpp07.cpp
|
|
Lab Program #8
-
PROGRAM TO IMPLEMENT QUEUE OPERATION USING TEMPLATES.
|
lab_cpp08.cpp
|
|
Lab Program #9
-
A C++ PROGRAM TO ILLUSTRATE THE WORKING OF DOUBLY LINKED LIST.
|
lab_cpp09.cpp
|
|
Lab Program #10
-
A C++ PROGRAM TO ADD AND SUBTRACT TWO LONG INTEGERS.
|
lab_cpp10.cpp
|
|
Lab Program #11
-
PROGRAM TO STORE THE DATA REGARDING UG & PG STUDENTS SEPARATELY & FIND THE SEMESTER WISE AVERAGE AGE.
|
lab_cpp11.cpp
|
|
Lab Program #12
-
A C++ PROGRAM TO CREATE A CLASS "STRING" & IMPLEMENT CONCATENATION OF TWO STRINGS.
|
lab_cpp12.cpp
|
|
Lab Program #13
-
A C++ PROGRAM TO ILLUSTRATE DIFFERENT TRAVERSAL OPERATIONS OF A BINARY TREE.
|
lab_cpp13.cpp
|
|
Lab Program #14
-
A C++ PROGRAM TO CONVERT INFIX EXP TO POSTFIX EXP.
|
lab_cpp14.cpp
|
|
Lab Program #15
-
A C++ PROGRAM TO IMPLEMENT ADDITION OF TWO POLYNOMIALS OBJECTS & DISPLAY RESULTS BY OVERLOADING '<<' OPERATOR.
|
lab_cpp15.cpp
|
|
|
|
Lab
:
LEX and YACC
|
|
LEX Lab Program #1a
- Write a program in LEX to count the number of vowels and consonants in a
given string.
YACC Lab Program #1b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
1a.l
|
|
y1b.y
|
|
LEX Lab Program #2a
- Write a program in LEX to count the number of
blanks, words, blanks, characters....
YACC Lab Program #2b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
2a.l
|
|
y2b.y
|
|
LEX Lab Program #3a
- Write a program in LEX to count the number of
positive numbers, negative numbers, positive fractions and
negative fractions.
YACC Lab Program #3b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
3a.l
|
|
y3b.y
|
|
LEX Lab Program #4a
- Write a program in LEX to check whether
the given C program is VALID or NOT.
YACC Lab Program #4b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
4a.l
|
|
y4b.y
|
|
LEX Lab Program #5a
- Write a program in LEX to count the number of
printf and scanf statements in a given C program or file..
YACC Lab Program #5b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
5a.l
|
|
y5b.y
|
|
LEX Lab Program #6a
- Write a LEX program to recognize a valid arithmetic expression. Count number of operators present and print them
separately.
YACC Lab Program #6b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
6a.l
|
|
y6b.y
|
|
LEX Lab Program #7a
- Write a program in LEX to check whether
the given sentence is a SIMPLE or COMPOUND sentence.
YACC Lab Program #7b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
7a.l
|
|
y7b.y
|
|
LEX Lab Program #8a
- Write a program in LEX to count the number of
identifiers in a C program.
YACC Lab Program #8b
- Write a program in LEX to count the number of vowels and consonants in a given string.
|
8a.l
|
|
y8b.y
|
|
|
|
Lab
:
Advanced Microprocessors Programming
***
Will be release soon ***
|
|
Lab Program #1a
- Search a key element in a list of n
numbers using the Binary Search Algorithm.
Lab Program #1b
- PROGRAM TO READ THE STATUS OF 8 INPUT BIT'S FROM THE LOGIC
CONTROLLER INTERFACE AND DISPLAY FF IF IT IS EVEN PARITY BITS OTHERWISE DISPLAY 00. ALSO DISPLAY NUMBER OF 1'S IN
THE INPUT DATA.
|
lab_1a.asm
|
|
lab_1b.asm
|
Lab Program #2a
- Write ALP macros :
1. To read a character from the keyboard in the module(1) [in a different file]
2. To display a character in module(2) [from different file]
3. Use the above two modules to read a string of characters from the keyboard terminated by the carriage and print the string on the display in the next line.
Lab Program #2b
- PERFORM THE FOLLOWING USING THE LOGIC CONTROLLER INTERFACE.
1. BCD UP-DOWN COUNTER.
2. RING COUNTER
|
lab_2a.asm
|
|
lab_2b1.asm
lab_2b2.asm
|
|
Lab Program #3a
- Sort a given set of ‘n’ numbers in ascending and descending orders using the
Bubble Sort Algorithm.
Lab Program #3b
- PROGRAM TO READ THE STATUS OF TWO 8 BITS INPUT [X AND Y] FROM
THE LOGIC CONTROLLER INTERFACE AND DISPLAY X * Y.
|
lab_3a.asm
|
|
lab_3b.asm
|
|
Lab Program #4a
- Read an alphanumeric character and display its
equivalent ASCII code at the center of the screen.
Lab Program #4b
- DISPLAY MESSAGE FIRE AND HELP ALTERNATELY WITH FLICKERING
EFFECTS ON A SEVEN SEGMENT DISPLAY INTERFACE FOR A SUITABLE PERIOD
OF TIME.
|
lab_4a.asm
|
|
lab_4b.asm
|
|
Lab Program #5a
- Reverse a given string and check whether
it is a palindrome or not.
Lab Program #5b
- ASSUME ANY SUITABLE MESSAGE OF 12 CHARACTERS LENGTH AND DISPLAY IT
IN ROLLING FASHION ON A SEVEN SEGMENT DISPLAY INTERFACE FOR A
SUITABLE PERIOD OF TIME.
|
lab_5a.asm
|
|
lab_5b.asm
|
|
Lab Program #6a
- Read two strings, store them in locations STR1 and STR2. Check whether they are
Equal or not and display appropriate messages. Also display the length of the stored Strings.
Lab Program #6b
- DRIVE A STEPPER MOTOR INTERFACE TO ROTATE THE MOTOR IN CLOCKWISE
DIRECTION BY N STEPS. INTRODUCE SUITABLE DELAY BETWEEN SUCCESSIVE
STEPS.
|
lab_6a.asm
|
|
lab_6b.asm
|
|
Lab Program #7a
- Read your name from the keyboard and
display it at a specified location on the screen
in front of the message What is your name? You
must clear the screen before display.
Lab Program #7b
- DRIVE THE STEPPER MOTOR INTERFACE TO ROTATE THE MOTOR BY N STEPS
LEFT DIRECTION AND N STEPS RIGHT DIRECTION. INTRODUCE SUITABLE
DELAY BETWEEN SUCCESSIVE STEPS.
|
lab_7a.asm
|
|
lab_7b.asm
|
|
Lab Program #8a
- Compute the factorial of a positive integer ‘n’ using recursive procedure.
Lab Program #8b
- SCAN A 8 X 3 KEYPAD FOR KEY CLOSURE AND TO STORE THE CODE OF THE
KEY PRESSED IN A MEMORY LOCATION OR DISPLAY ON SCREEN. ALSO DISPLAY
ROW AND COLUMN NUMBERS OF THE KEY PRESSED.
|
lab_8a.asm
|
|
lab_8b.asm
|
|
Lab Program #9a
- Compute nCr using recursive procedure. Assume that ‘n’ and ‘r’ are non-negative integers.
Lab Program #9b
- SCAN A 8 x 3 KEYPAD FOR A KEY CLOSURE AND SIMULATE ADD AND SUBTRACT
OPERATIONS AS IN A CALCULATOR.
|
lab_9a.asm
|
|
lab_9b.asm
|
|
Lab Program #10a
- Find out whether a given sub-string is present or not in a main string of characters.
Lab Program #10b
- GENERATE A SINE WAVE USING THE DAC
INTERFACE.
|
lab_10a.asm
|
|
lab_10b.asm
|
|
Lab Program #11a
- Generate the first ‘n’ Fibonacci
numbers.
Lab Program #11b
-
GENERATE A HALF RECTIFIED SINE WAVE FORM USING THE DAC
INTERFACE.
|
lab_11a.asm
|
|
lab_11b.asm
|
|
Lab Program #12a
- Read the current time from the system and
display it in the standard format on the screen.
Lab Program #12b
- GENERATE A FULLY RECTIFIED SINE WAVE FORM USING THE DAC INTERFACE.
|
lab_12a.asm
|
|
lab_12b.asm
|
|
Lab Program #13a
- Program to simulate a Decimal Up-counter to display 00-99.
Lab Program #13b
-
DRIVE AN ELEVATOR INTERFACE IN THE FOLLOWING WAY TO MOVE AND
ELEVATOR FROM GROUND TO TOP FLOOR AND TOP TO GROUND FLOOR.
|
lab_13a.asm
|
|
lab_13b.asm
|
|
Lab Program #14a
- Read a pair of input co-ordinates in BCD
and move the cursor to the specified location on the
screen.
|
lab_14a.asm
|
|
|
|
Lab Program #15a
- Program to create a file (input file)
and to delete an existing file.
|
lab_15a.asm
|
|
|
|
NOTE: No liability
assumed for damages resulting from the use of the available
information. Also portability of the code is not assured.
Watch
out for more...
|