//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib.

Size: px
Start display at page:

Download "//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib."

Transcription

1 //2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib.h> void main() int gd=detect,gm,i,x[10],y[10],a,b,c,d,n,tx,ty,sx,sy,ch; float ang; initgraph(&gd,&gm,"c:\\tc\\bgi"); setbkcolor(white); printf("\n\tenter THE NUMBER OF SIDES:"); scanf("%d",&n); for(i=0;i<n;i++) printf("\n\nenter THE CO-ORDINATES FOR SIDE %d :",i+1); scanf("%d %d",&x[i],&y[i]); setcolor(magenta); for(i=0;i<n-1;i++) line(x[i],y[i],x[i+1],y[i+1]); line(x[n-1],y[n-1],x[0],y[0]);

2 getch(); do printf("\n1.translation\n2.rotation\n3.scaling\n4.exit"); printf("\n\tenter YOUR CHOICE:"); scanf("%d",&ch); switch(ch) case 1: cleardevice(); printf("\n\ttranslation\n ENTER TRANSLATION VECTOR:"); scanf("%d %d",&tx,&ty); setcolor(blue); for(i=0;i<n-1;i++) line(x[i]+tx,y[i]+ty,x[i+1]+tx,y[i+1]+ty); line(x[n-1]+tx,y[n-1]+ty,x[0]+tx,y[0]+ty); getch(); case 2: cleardevice(); printf("\n\trotation"); printf("\n\tenter THE ANGLE :"); scanf("%f",&ang); ang*=3.14/180;

3 getch(); setcolor(5); for(i=0;i<n-1;i++) a=x[i]*cos(ang)-y[i]*sin(ang)+150; b=x[i]*sin(ang)+y[i]*cos(ang); c=x[i+1]*cos(ang)-y[i+1]*sin(ang)+150; d=x[i+1]*sin(ang)+y[i+1]*cos(ang); line(a,b,c,d); a=x[n-1]*cos(ang)-y[n-1]*sin(ang)+150; b=x[n-1]*sin(ang)+y[n-1]*cos(ang); c=x[0]*cos(ang)-y[0]*sin(ang)+150; d=x[0]*sin(ang)+y[0]*cos(ang); line(a,b,c,d); getch(); case 3: cleardevice(); printf("\n\tscaling \n ENTER SCALING FACTOR :"); scanf("%d %d",&sx,&sy); setcolor(blue); for(i=0;i<n-1;i++) line(x[i]*sx,y[i]*sy,x[i+1]*sx,y[i+1]*sy);

4 line(x[n-1]*sx,y[n-1]*sy,x[0]*sx,y[0]*sy); getch(); case 4: exit(-1); while(ch<=4); 2. 2D-TRANSFORMATION PROGRAM:2 #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<alloc.h> #include<stdlib.h> int n,i,p[20],q[20]; int convertx(int x); int converty(int y); void axis(void); void init(void); void share(void); void translate(void); void scaling(void);

5 void rotate(void); void reflect(void); void main( ) int ch, gd=detect,gm; initgraph(&gd,&gm,"e:\\tc\\bgi"); axis( ); printf("\b"); cleardevice( ); printf("enter THE NUMBER OF VERTICES:"); scanf("%d",&n); printf("enterthecoordinate(reenterthefirstvertexattheend )"); for(i=0;i<2*n+2;i++) scanf("%d",&p[i]); clrscr( ); init( ); getch( ); do clrscr( ); cleardevice( ); printf("\n\t\t2d-transformations\n1.translation\n 2. ROTATION\n 3.SCALING\n4.REFLECTION\n5.SHARING\n"); printf("\n\n ENTER UR CHOICE:\n"); scanf("%d",&ch); clrscr( ); cleardevice( ); switch(ch) case 1:axis( );

6 init( ); translate( ); case 2:axis( ); init( ); rotate( ); case 3:axis( ); init( ); scaling( ); case 4:reflect( ); case 5:share( ); while(ch!=6); closegraph( ); void axis(void) cleardevice( ); setlinestyle(solid_line,1,1); line(320,0,320,getmaxy( )); line(0,240,getmaxx( ),240); outtextxy(325,245,"0"); line(316,40,324,40);

7 outtextxy(325,41,"400"); line(316,440,324,440); outtextxy(325,441,"-400"); line(20,236,20,244); outtextxy(19,250,"-600"); line(620,236,620,244); outtextxy(608,250,"600"); void init( ) cleardevice( ); axis( ); setcolor(yellow); setlinestyle(solid_line,1,1); q[i]=convertx(p[i]); q[i]=converty(p[i]); drawpoly(n+1,q); setcolor(white); int convertx(int x) x=x/2; return(x+=320); int converty(int y) y=y/2;

8 return(y=240-y); void share( ) int sh[20],shr[20]; float shx,shy,c; printf("(1)share RELATIVE TO X-AXIS \n"); printf("(2)share RELATIVE TO Y-AXIS \n"); printf("\n ENTER UR CHOICE:"); scanf("%f",&c); if(c==1) init( ); printf("\n ENTER THE SHARE FACTOR(shx):"); scanf("%f",&shx); sh[i]=p[i]+(shx*(p[i+1])); sh[i]=p[i]; else init( ); printf("\n ENTER THE SHARE FACTOR(shy):"); scanf("%f",&shy); sh[i]=(shy*p[i-1])+p[i]; sh[i]=p[i];

9 setlinestyle(dotted_line,1,1); shr[i]=convertx(sh[i]); shr[i]=converty(sh[i]); drawpoly(n+1,shr); getch( ); void translate( ) int tr[20],tr1[20],tx,ty; printf("\n ENTER THR X-TRANSLATION VECTOR:"); scanf("%d",&tx); printf("\n ENTER THR Y-TRANSLATION VECTOR:"); scanf("%d",&ty); tr[i]=p[i]+tx; tr[i]=p[i]+ty; setlinestyle(dotted_line,1,1); tr1[i]=convertx(tr[i]); tr1[i]=converty(tr[i]); drawpoly(n+1,tr1); getch( );

10 void scaling( ) int sc[20],sc1[20]; float sx,sy; printf("\n ENTER THE X-AXIS SCALING FACTOR:"); scanf("%f",&sx); printf("\n ENTER THE Y-AXIS SCALING FACTOR:"); scanf("%f",&sy); sc[i]=p[i]*sx; sc[i]=p[i]*sy; setlinestyle(dotted_line,1,1); sc1[i]=convertx(sc[i]); sc1[i]=converty(sc[i]); drawpoly(n+1,sc1); getch( ); void rotate( ) int ro[20],rot[20],xr,yr,v; float ang; printf("\n ENTER THE ANGLE TO ROTATE:"); scanf("%f",&ang); ang=((ang*3.14)/180)*(-1);

11 printf("\n ENTER THE ROTATION VERTEX ("); for(i=1;i<=n;i++) printf("%d)",i); scanf("%d",&v); xr=p[(2*v)-2]; yr=p[((2*v)-2)+1]; for(i=0;i<(2*n+1);i+=2) ro[i]=xr+(p[i]-xr)*cos(ang)-(p[i+1]-yr)*sin(ang); ro[i+1]=yr+(p[i]-xr)*sin(ang)+(p[i+1]-yr)*cos(ang); setlinestyle(dotted_line,1,1); rot[i]=convertx(ro[i]); rot[i]=converty(ro[i]); drawpoly(n+1,rot); getch( ); void reflect( ) int j,c,rt[20],rft[20]; printf("\n1.x-axis REFLECTION\n2.y-AXIS REFLECTION"); printf("\n ENTER THE CHOICE:"); scanf("%d",&c); clrscr( ); cleardevice( ); if(c==1)

12 rt[i]=p[i]*(-1); rt[i]=p[i]; else rt[i]=p[i]*(-1); rt[i]=p[i]; init( ); setlinestyle(dotted_line,1,1); rft[i]=convertx(rt[i]); rft[i]=converty(rt[i]); drawpoly(n+1,rft); getch( );

13

LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM

LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM Ex.no :1 Date: LINE,CIRCLE AND ELLIPSE DRAWING USING BRESENHAM S ALGORITHM AIM: To write a program to implement Bresenham s algorithms for line, circle and ellipse drawing. ALGORITHM: Step1: Create a function

More information

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with Two Dimensional Transformations In many applications, changes in orientations, size, and shape are accomplished with geometric transformations that alter the coordinate descriptions of objects. Basic geometric

More information

February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA

February 1. Lab Manual INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR COMPUTER GRAPHICS & MUTIMEDIA Lab Manual February 1 2014 COMPUTER GRAPHICS & MUTIMEDIA INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT GWALIOR SOFTWARE REQUIREMENT : 1. Turbo C++ IDE (TurboC3) 2. Borland Turbo C++ (Version 4.5) LIST

More information

LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini

LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini LAB MANUAL OF COMPUTER GRAPHICS BY: Mrs. Manisha Saini INTRODUCTION TO COMPUTER GRAPHICS Computer Graphics is the pictorial representation of information using a computer program. In Computer Graphics,

More information

AIM:- To write a C program to create a singly linked list implementation.

AIM:- To write a C program to create a singly linked list implementation. SINGLY LINKED LIST AIM:- To write a C program to create a singly linked list implementation. ALGORITHM:- 1. Start the program. 2. Get the choice from the user. 3. If the choice is to add records, get the

More information

Windowing And Clipping (14 Marks)

Windowing And Clipping (14 Marks) Window: 1. A world-coordinate area selected for display is called a window. 2. It consists of a visual area containing some of the graphical user interface of the program it belongs to and is framed by

More information

SIR C.R.R COLLEGE OF ENGINEERING, ELURU.

SIR C.R.R COLLEGE OF ENGINEERING, ELURU. SIR C.R.R COLLEGE OF ENGINEERING, ELURU. DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING GRAPHICS AND MULTIMEDIA LAB MANUAL ACADEMIC YEAR: 2016-2017 CLASS : 4/4 B.Tech CSE I SEMESTER SUBJECT : Graphics &

More information

DDA ALGORITHM. To write a C program to draw a line using DDA Algorithm.

DDA ALGORITHM. To write a C program to draw a line using DDA Algorithm. DDA ALGORITHM EX NO: 1 Aim : To write a C program to draw a line using DDA Algorithm. Algorithm: Step 1: Start the program. Step 1: Step 2: Input the line endpoints and store the left endpoint in (x1,

More information

MGM S JAWAHARLAL NEHRU ENGINEERING COLLEGE N-6, CIDCO, AURANGABAD LAB MANUALS SUB: COMPUTER LAB-II CLASS: S.E.CIVIL

MGM S JAWAHARLAL NEHRU ENGINEERING COLLEGE N-6, CIDCO, AURANGABAD LAB MANUALS SUB: COMPUTER LAB-II CLASS: S.E.CIVIL MGM S JAWAHARLAL NEHRU ENGINEERING COLLEGE N-6, CIDCO, AURANGABAD LAB MANUALS (Procedure for conduction of Practical/Term Work) SUB: COMPUTER LAB-II CLASS: S.E.CIVIL Prepared by Ms.V.S.Pradhan Lab In charge

More information

1. DDA Algorithm(Digital Differential Analyzer)

1. DDA Algorithm(Digital Differential Analyzer) Basic concepts in line drawing: We say these computers have vector graphics capability (the line is a vector). The process is turning on pixels for a line segment is called vector generation and algorithm

More information

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff;

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff; /* Polynomial Expressions Using Linked List*/ #include #include #include struct node int num; int coeff; struct node *next; ; struct node *start1 = NULL; struct node *start2

More information

THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COMPUTER GRAPHICS LAB (CS 2405) REG.

THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COMPUTER GRAPHICS LAB (CS 2405) REG. THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COMPUTER GRAPHICS LAB (CS 2405) NAME REG. NUMBER SEMESTER YEAR : : : : THIRUMALAI ENGINEERING COLLEGE

More information

POLYNOMIAL ADDITION. AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition.

POLYNOMIAL ADDITION. AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition. POLYNOMIAL ADDITION AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition. ALGORITHM:- 1. Start the program 2. Get the coefficients and powers

More information

C Programming Lecture V

C Programming Lecture V C Programming Lecture V Instructor Özgür ZEYDAN http://cevre.beun.edu.tr/ Modular Programming A function in C is a small sub-program that performs a particular task, and supports the concept of modular

More information

Program. SUBJECT: ACP (C - Programming) Array Program. // Find the minimum number from given N element. Prepared By : Dhaval R.

Program. SUBJECT: ACP (C - Programming) Array Program. // Find the minimum number from given N element. Prepared By : Dhaval R. Program // Find the minimum number from given N element. #include #include void main() int a[50],i,n,min; clrscr(); printf("\n Enter array size : "); scanf("%d",&n); printf("\n Enter

More information

MAHATMA GANDHI MISSION S JAWAHARLAL NEHRU ENGINEERING COLLEGE, AURANGABAD. (M.S.)

MAHATMA GANDHI MISSION S JAWAHARLAL NEHRU ENGINEERING COLLEGE, AURANGABAD. (M.S.) MAHATMA GANDHI MISSION S JAWAHARLAL NEHRU ENGINEERING COLLEGE, AURANGABAD. (M.S.) DEPARTMENT OF CIVIL ENGINEERING COMPUTER LAB- II LAB MANUAL Prepared By Approved By Dr.V.S.Pradhan Dr. S. B. Shinde Lab

More information

IMPLEMENTATION OF DDA LINE ALGORITHM

IMPLEMENTATION OF DDA LINE ALGORITHM IMPLEMENTATION OF DDA LINE ALGORITHM DESCRIPTION: Digital Differential Analyzer (DDA) is used for linear interpolation of variables over an interval between start and end point of a line. Simplest implementation

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

Lab 10: Disk Scheduling Algorithms

Lab 10: Disk Scheduling Algorithms 1. Objective Lab 10: Disk Scheduling Algorithms Understand Disk Scheduling Algorithm and read its code for SSTF, SCAN, CSCAN in C, 2. Syllabus try to write other kinds of disk scheduling algorithms such

More information

INDEX BUBBLE SORT INSERTION SORT SELECTION SORT PATTREN MATCHING LINEAR SEARCH BINARY SEARCH QUICK SORT MERGE SORT STACK OPERATION USING ARRAY

INDEX BUBBLE SORT INSERTION SORT SELECTION SORT PATTREN MATCHING LINEAR SEARCH BINARY SEARCH QUICK SORT MERGE SORT STACK OPERATION USING ARRAY INDEX S.No. Date Title Page No. Teacher s Sign 1. BUBBLE SORT 2. INSERTION SORT 3. SELECTION SORT 4. PATTREN MATCHING 5. LINEAR SEARCH 6. BINARY SEARCH 7. QUICK SORT 8. MERGE SORT 9. STACK OPERATION USING

More information

DEPARTMENT OF INFORMATION TECHNOLOGY DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR , CUDDALORE DIST.

DEPARTMENT OF INFORMATION TECHNOLOGY DR.NAVALAR NEDUNCHEZHIAYN COLLEGE OF ENGINEERING, THOLUDUR , CUDDALORE DIST. CS1357-GRAPHICS AND MULTIMEDIA LABORATORY LABORATORY MANUAL FOR VII SEMESTER B.TECH / IT ACADEMIC YEAR: 2013 2014 (ODD) (FOR PRIVATE CIRCULATION ONLY) ANNA UNIVERSITY, CHENNAI. DEPARTMENT OF INFORMATION

More information

//Program1. Computer Graphics C Version Programmed By: Salha Alzahrani

//Program1. Computer Graphics C Version Programmed By: Salha Alzahrani 1 //Program1 #include #include #include #include #include #include int array1[100]; int angle[100]; void initialize_graph(void) /* select a driver

More information

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan Case Control Structure DCS COMSATS Institute of Information Technology Rab Nawaz Jadoon Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) Decision control

More information

CS COMPUTER GRAPHICS LAB

CS COMPUTER GRAPHICS LAB CS2405 - COMPUTER GRAPHICS LAB 1. Output primitives. 2. Implementation of Bresenhams Algorithm Line, Circle, Ellipse. 3. Implementation of Line, Circle and ellipse Attributes 4. Two Dimensional transformations

More information

Arrays in C. By Mrs. Manisha Kuveskar.

Arrays in C. By Mrs. Manisha Kuveskar. Arrays in C By Mrs. Manisha Kuveskar. C Programming Arrays An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 2rd Semester: 3rd CBNST Lab-PCS-302 LAB MANUAL Prepared By: HOD (CSE) DEV BHOOMI INSTITUTE OF TECHNOLOGY Department

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA INTERNAL ASSESSMENT TEST 2 (Scheme and Solution) Data Structures Using C (16MCA11) 1) A.

More information

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields:

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields: Assignment 6 Q1. Create a database of students using structures, where in each entry of the database will have the following fields: 1. a name, which is a string with at most 128 characters 2. their marks

More information

Lab Programs. /* LAB1_2: To study the various graphics commands in C language */ /* LAB1_1: To study the various graphics commands in C language */

Lab Programs. /* LAB1_2: To study the various graphics commands in C language */ /* LAB1_1: To study the various graphics commands in C language */ Lab Programs /* LAB1_1: To study the various graphics commands in C language */ /* drawing basic shapes */ #include #include void main() int gd=detect, gm; int poly[12]=350,450, 350,410,

More information

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data

More information

LAB MANUAL. ANTC Lab (ME-321- F) DEPARTMENT OF APPLIED SCIENCE AND HUMINITIES

LAB MANUAL. ANTC Lab (ME-321- F) DEPARTMENT OF APPLIED SCIENCE AND HUMINITIES LAB MANUAL ANTC Lab (ME-321- F) DEPARTMENT OF APPLIED SCIENCE AND HUMINITIES 1 Check list for Lab Manual S. No. Particulars Page Number 1 Mission and Vision 3 2 Guidelines for the student 4 3 List of Programs

More information

Computers Programming Course 12. Iulian Năstac

Computers Programming Course 12. Iulian Năstac Computers Programming Course 12 Iulian Năstac Recap from previous course Strings in C The character string is one of the most widely used applications that involves vectors. A string in C is an array of

More information

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 2nd Semester: 3rd Data Structures- PCS-303 LAB MANUAL Prepared By: HOD(CSE) DEV BHOOMI

More information

Problem # 1. calculate the grade. Allow a student the next grade if he/she needs only 0.5 marks to obtain the next grade. Use else-if construction.

Problem # 1. calculate the grade. Allow a student the next grade if he/she needs only 0.5 marks to obtain the next grade. Use else-if construction. ME 172 Lecture 6 Problem # 1 Write a program to calculate the grade point average of a 3.00 credit hour course using the data obtained from the user. Data contains four items: attendance (30), class test

More information

LABORATORY MANUAL. (CSE-103F) FCPC Lab

LABORATORY MANUAL. (CSE-103F) FCPC Lab LABORATORY MANUAL (CSE-103F) FCPC Lab Department of Computer Science & Engineering BRCM College of Engineering & Technology Bahal, Haryana Aim: Main aim of this course is to understand and solve logical

More information

APPENDIX. A.1 Evaluation of thermodynamic property values for the gases. constant pressure, specific enthalpy and specific entropy of various

APPENDIX. A.1 Evaluation of thermodynamic property values for the gases. constant pressure, specific enthalpy and specific entropy of various 223 APPENDIX A.1 Evaluation of thermodynamic property values for the gases comprising C-H-O-N System The following equations are used to calculate specific heat at constant pressure, specific enthalpy

More information

Lab-Report Digital Signal Processing. FIR-Filters. Model of a fixed and floating point convolver

Lab-Report Digital Signal Processing. FIR-Filters. Model of a fixed and floating point convolver Lab-Report Digital Signal Processing FIR-Filters Model of a fixed and floating point convolver Name: Dirk Becker Course: BEng 2 Group: A Student No.: 9801351 Date: 30/10/1998 1. Contents 1. CONTENTS...

More information

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer. Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting

More information

UNIT 3 FUNCTIONS AND ARRAYS

UNIT 3 FUNCTIONS AND ARRAYS UNIT 3 FUNCTIONS AND ARRAYS Functions Function definitions and Prototypes Calling Functions Accessing functions Passing arguments to a function - Storage Classes Scope rules Arrays Defining an array processing

More information

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement UNIT- II: Control Flow: Statements and Blocks, if, switch statements, Loops: while, do-while, for, break and continue, go to and Labels. Arrays and Strings: Introduction, One- dimensional arrays, Declaring

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

CSE202-Lec#4. CSE202 C++ Programming

CSE202-Lec#4. CSE202 C++ Programming CSE202-Lec#4 Functions and input/output streams @LPU CSE202 C++ Programming Outline Creating User Defined Functions Functions With Default Arguments Inline Functions @LPU CSE202 C++ Programming What is

More information

DMI College of Engineering

DMI College of Engineering DMI College of Engineering (Affiliated to Anna University, Chennai-600 025) Palanchur, Chennai-602 123. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6513 COMPUTER GRAPHICS LABORATORY V SEMESTER/ III

More information

List of Programs: Programs: 1. Polynomial addition

List of Programs: Programs: 1. Polynomial addition List of Programs: 1. Polynomial addition 2. Common operations on vectors in c 3. Matrix operation: multiplication, transpose 4. Basic Unit conversion 5. Number conversion: Decimal to binary 6. Number conversion:

More information

UNIT VI. STACKS AND QUEUES

UNIT VI. STACKS AND QUEUES UNIT VI. STACKS AND QUEUES Syllabus: /*-------------------------------------------------------------------------*/ Stack: Definition: "Stack is an ordered collection of data elements having similar data

More information

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring Programming and Data Structures Mid-Semester - s to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring 2015-16 February 15, 2016 1. Tick the correct options. (a) Consider the following

More information

Tutorial No. 2 - Solution (Overview of C)

Tutorial No. 2 - Solution (Overview of C) Tutorial No. 2 - Solution (Overview of C) Computer Programming and Utilization (2110003) 1. Explain the C program development life cycle using flowchart in detail. OR Explain the process of compiling and

More information

BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER

BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER 2017-2018 COURSE : COMPUTER PROGRAMMING (CS F111) COMPONENT : Tutorial#4 (SOLUTION) DATE : 09-NOV-2017 Answer 1(a). #include

More information

International Journal of Mathematics & Computing. Research Article

International Journal of Mathematics & Computing. Research Article www.advancejournals.org Open Access Scientific Publisher Research Article C/C++ PROGRAM: DETERMINATION OF ENERGY BAND GAP FROM UV-VISIBLE SPECTROGRAPH RESULTS ABSTRACT Rajivgandhi S 1, Dinesh Kumar A 2,

More information

Algorithms Lab (NCS 551)

Algorithms Lab (NCS 551) DRONACHARYA GROUP OF INSTITUTIONS, GREATER NOIDA Affiliated to Utter Pradesh Technical University Noida Approved by AICTE Algorithms Lab (NCS 551) SOLUTIONS 1. PROGRAM TO IMPLEMENT INSERTION SORT. #include

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure using C Model wer Subject Code: 22317 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given

More information

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

CS 108 Computing Fundamentals. October/November Array Bootcamp

CS 108 Computing Fundamentals. October/November Array Bootcamp CS 108 Computing Fundamentals October/November 2017 Array Bootcamp For arrays: passing to a function "by value" means passing a single element's "contents" For arrays: no more than one element's contents

More information

/*Tree Traversals*/ #include<stdio.h> #include<conio.h> typedef struct bin { int data; struct bin *left,*right; }node;

/*Tree Traversals*/ #include<stdio.h> #include<conio.h> typedef struct bin { int data; struct bin *left,*right; }node; /*Tree Traversals*/ #include #include typedef struct bin int data; struct bin *left,*right; node; void insert(node *,node *); void inorder(node *); void preorder(node *); void postorder(node

More information

FUNCTIONS OMPAL SINGH

FUNCTIONS OMPAL SINGH FUNCTIONS 1 INTRODUCTION C enables its programmers to break up a program into segments commonly known as functions, each of which can be written more or less independently of the others. Every function

More information

/*Addition of two polynomials*/ #include<stdio.h> #include<malloc.h> #include<conio.h> struct link { int coeff; int pow; struct link *next; }; struct

/*Addition of two polynomials*/ #include<stdio.h> #include<malloc.h> #include<conio.h> struct link { int coeff; int pow; struct link *next; }; struct /*Addition of two polynomials*/ #include #include #include struct link int coeff; int pow; struct link *next; ; struct link *poly1=null,*poly2=null,*poly=null; void create(struct

More information

Single linked list. Program: #include<stdio.h> #include<conio.h> #include<alloc.h> struct node. int info; struct node *next; void main()

Single linked list. Program: #include<stdio.h> #include<conio.h> #include<alloc.h> struct node. int info; struct node *next; void main() Single linked list Program: #include #include #include struct node int info; struct node *next; ; void main() struct node *s,*start,*prev,*new1,*temp,*temp1,*ptemp; int cho,i,j,x,n,p;

More information

SOFTWARE TESTING LABORATORY. Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50

SOFTWARE TESTING LABORATORY. Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50 SOFTWARE TESTING LABORATORY Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50 1. Design and develop a program in a language of your choice to solve the Triangle

More information

Engineering 12 - Spring, 2000

Engineering 12 - Spring, 2000 Engineering 12 - Spring, 2000 1. (20 points) Shown below is a program to determine the total price for a group to attend a movie. The program asks the user to enter the number of people in the group, the

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering. Algorithm lab- PCS-553 LAB MANUAL

DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering. Algorithm lab- PCS-553 LAB MANUAL DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 3rd Semester: 5th Algorithm lab- PCS-553 LAB MANUAL Prepared By: HOD (CSE) 1 DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV

More information

SELECTION STATEMENTS:

SELECTION STATEMENTS: UNIT-2 STATEMENTS A statement is a part of your program that can be executed. That is, a statement specifies an action. Statements generally contain expressions and end with a semicolon. Statements that

More information

MC9217 / Programming and Data Structures Lab MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C

MC9217 / Programming and Data Structures Lab MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C 0 0 3 2 1.Create a Stack and do the following operations using arrays and linked lists (i)push (ii) Pop (iii) Peep 2.Create a Queue and do the following

More information

Contents. Sr. No. Title of the Practical: Page no Signature. Gate. OR gate. EX-OR gate. gate. identifying ODD and EVEN number.

Contents. Sr. No. Title of the Practical: Page no Signature. Gate. OR gate. EX-OR gate. gate. identifying ODD and EVEN number. Contents Sr. No. Title of the Practical: Page no Signature 01. To Design and train a perceptron for AND Gate. 02. To design and train a perceptron training for OR gate. 03. To design and train a perceptron

More information

DS Lab Manual -17CS33

DS Lab Manual -17CS33 Chethan Raj C Assistant Professor Dept. of CSE 6. Design, Develop and Implement a menu driven Program in C for the following operations on Circular QUEUE of Characters (Array Implementation of Queue with

More information

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List in Data Structure By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List Like arrays, Linked List is a linear data

More information

dynamic memory allocation

dynamic memory allocation Dynamic memory allocation in C The concept of dynamic memory allocation in c language enables the C programmer to allocate memory at runtime. Dynamic memory allocation in c language is possible by 4 functions

More information

Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon

Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon Data Structures &Al Algorithms Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon What is Data Structure Data Structure is a logical relationship existing between individual elements

More information

Sankha Narayan Bose B.Tech Student in Information Technology Department, Kalyani Government Engineering College,Krishnagar,Nadia,India

Sankha Narayan Bose B.Tech Student in Information Technology Department, Kalyani Government Engineering College,Krishnagar,Nadia,India Empirical Problem Related To Variation in Population Ageing Between Males & Females over a Period from 1960 to 1981 by Making Use of Statistical Regression Technique & C Programming Language Sankha Narayan

More information

ME 172. C Programming Language Sessional Lecture 8

ME 172. C Programming Language Sessional Lecture 8 ME 172 C Programming Language Sessional Lecture 8 Functions Functions are passages of code that have been given a name. C functions can be classified into two categories Library functions User-defined

More information

Lab Manual B.Tech 1 st Year

Lab Manual B.Tech 1 st Year Lab Manual B.Tech 1 st Year Fundamentals & Computer Programming Lab Dev Bhoomi Institute of Technology Dehradun www.dbit.ac.in Affiliated to Uttrakhand Technical University, Dehradun www.uktech.in CONTENTS

More information

Chapter - 2 Complexity of Algorithms for Iterative Solution of Non-Linear Equations

Chapter - 2 Complexity of Algorithms for Iterative Solution of Non-Linear Equations Chapter - Compleity of Algorithms for Iterative Solution of Non-Linear Equations Compleity of Algorithms for Iterative... 19 CHAPTER - Compleity of Algorithms for Iterative Solution of Non-Linear Equations.1

More information

MODULE 1. Introduction to Data Structures

MODULE 1. Introduction to Data Structures MODULE 1 Introduction to Data Structures Data Structure is a way of collecting and organizing data in such a way that we can perform operations on these data in an effective way. Data Structures is about

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 1 st Semester:1 st C Programming Lab- LAB MANUAL INDEX S.No. Experiments Software Used 1. To find the sum of individual

More information

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

NUMERICAL METHODS AND COMPUTATIONAL PROGRAMMING LAB MATH-204-F

NUMERICAL METHODS AND COMPUTATIONAL PROGRAMMING LAB MATH-204-F LAB MANUAL NUMERICAL METHODS AND COMPUTATIONAL PROGRAMMING LAB MATH-204-F LIST OF EXPERIMENTS NUMERICAL METHODS OF COMPUTATIONAL PROGRAMMING LAB MATH-204-F S. No. NAME OF EXPERIMENTS 1. Solution of Non-linear

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

PROGRAM 1 AIM: Write a program to find the number of vertices, even vertices, odd vertices and the number of edges in a graph.

PROGRAM 1 AIM: Write a program to find the number of vertices, even vertices, odd vertices and the number of edges in a graph. PROGRAM 1 AIM: Write a program to find the number of vertices, even vertices, odd vertices and the number of edges in a graph. CODE: #include using namespace std; #include #define MAX

More information

DEV BHOOMI INSTITUE OF TECHNOLOGY DEHRADUN Department Of Computer Application. Design and Analysis of Algorithms Lab MCA-302

DEV BHOOMI INSTITUE OF TECHNOLOGY DEHRADUN Department Of Computer Application. Design and Analysis of Algorithms Lab MCA-302 DEV BHOOMI INSTITUE OF TECHNOLOGY DEHRADUN Department Of Computer Application Design and Analysis of Algorithms Lab MCA-302 1 INDEX S.No. PRACTICAL NAME DATE PAGE NO. SIGNATURE 1. Write a Program to Implement

More information

UNDERSTANDING THE COMPUTER S MEMORY

UNDERSTANDING THE COMPUTER S MEMORY POINTERS UNDERSTANDING THE COMPUTER S MEMORY Every computer has a primary memory. All our data and programs need to be placed in the primary memory for execution. The primary memory or RAM (Random Access

More information

Annexure-I. #include<stdio.h> #include<graphics.h> #include<conio.h> #include<math.h> #include<stdlib.h> #include<string.h>

Annexure-I. #include<stdio.h> #include<graphics.h> #include<conio.h> #include<math.h> #include<stdlib.h> #include<string.h> Annexure-I #include #include #include #include #include #include #define GRID_COLOR 8 #define AXIS_COLOR 2 #define FAN_COLOR 12 #define MINE_COLOR

More information

BSc.(Hons.) Business Information Systems, BSc. (Hons.) Computer Science with Network Security, BSc.(Hons.) Software Engineering

BSc.(Hons.) Business Information Systems, BSc. (Hons.) Computer Science with Network Security, BSc.(Hons.) Software Engineering BSc.(Hons.) Business Information Systems, BSc. (Hons.) Computer Science with Network Security, BSc.(Hons.) Software Engineering Cohorts BIS/04 Full Time - BCNS/04 Full Time SE/04 Full Time Examinations

More information

HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP )

HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP ) HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP ) 1.Write the steps to do the Following: a) Enter in to WordPad b) Enter 3 lines with suitable Heading c) Save the

More information

DEPARTMENT VISION AND MISSION

DEPARTMENT VISION AND MISSION INSTITUTE VISION AND MISSION Vision To emerge as a destination for higher education by transforming learners into achievers by creating, encouraging and thus building a supportive academic environment.

More information

The pictorial representation and manipulation of data by a compute. The creation, display, and storage of pictures, with a computer

The pictorial representation and manipulation of data by a compute. The creation, display, and storage of pictures, with a computer Nihar Ranjan Roy The pictorial representation and manipulation of data by a compute The creation, display, and storage of pictures, with a computer Computer graphics is a sub-field of computer science

More information

Decision Making and Branching

Decision Making and Branching INTRODUCTION Decision Making and Branching Unit 4 In the previous lessons we have learned about the programming structure, data types, declaration of variables, tokens, constants, keywords and operators

More information

SUMMER 13 EXAMINATION Model Answer

SUMMER 13 EXAMINATION Model Answer Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

// CSE/CE/IT 124 JULY 2015, 2.a. algorithm to inverse the digits of a given integer. Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0

// CSE/CE/IT 124 JULY 2015, 2.a. algorithm to inverse the digits of a given integer. Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0 // CSE/CE/IT 124 JULY 2015, 2a algorithm to inverse the digits of a given integer Step 1: Start Step 2: Read: NUMBER Step 3: r=0,rev=0 Step 4: repeat until NUMBER > 0 r=number%10; rev=rev*10+r; NUMBER=NUMBER/10;

More information

7.STRINGS. Data Structure Management (330701) 1

7.STRINGS. Data Structure Management (330701)   1 Strings and their representation String is defined as a sequence of characters. 7.STRINGS In terms of c language string is an array of characters. While storing the string in character array the size of

More information

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Data Structure using C

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Data Structure using C S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Data Structure using C Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 100 Q.1 (a) Attempt any SIX of the following : [12] Q.1 (a) (i) Define time complexity

More information

Preview from Notesale.co.uk Page 4 of 63

Preview from Notesale.co.uk Page 4 of 63 1. Write a program to compute area of a circle after reading input from user. #include #include int float area, radius, pi=3.141; printf("enter the radius of circle \t"); scanf("%f",

More information

International Journal of Advanced Research in Computer Science and Software Engineering

International Journal of Advanced Research in Computer Science and Software Engineering Volume 2, Issue 9, September 2012 ISSN: 2277 128X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Case Study

More information

Numerical Method (2068 Third Batch)

Numerical Method (2068 Third Batch) 1. Define the types of error in numerical calculation. Derive the formula for secant method and illustrate the method by figure. There are different types of error in numerical calculation. Some of them

More information

F.E. Sem. II. Structured Programming Approach

F.E. Sem. II. Structured Programming Approach F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 13 [Marks : 80 Q.1(a) Explain the purpose of following standard library functions : [3] (i)

More information

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array? 1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The

More information

An array is a collection of similar elements that is all the elements in an array should have same data type. This means that an array can store

An array is a collection of similar elements that is all the elements in an array should have same data type. This means that an array can store An array is a collection of similar elements that is all the elements in an array should have same data type. This means that an array can store either all integers, all floating point numbers, all characters,

More information

"'"' .;, b) F or ( c = l ; c <= 10,"' c++ ) X { JJ. ~. Computer Programming I COME Midterm Examination. Fall November 2016

'' .;, b) F or ( c = l ; c <= 10,' c++ ) X { JJ. ~. Computer Programming I COME Midterm Examination. Fall November 2016 Group B ~. Computer Programming I COME 103 - Midterm Examination B Fall 2016 21 November 2016 1. Identify and correct the errors in each of the following statements. (Note: There may be more than one error.)

More information

Computer design and manufacturing lab manual

Computer design and manufacturing lab manual Computer design and manufacturing lab manual 01. BRESENHAM S ALGORITHM FOR LINE DRAWING. 1. Start. 2. Declare variables x,y,x1,y1,x2,y2,p,dx,dy and also declare gdriver=detect,gmode. 3. Initialize the

More information

Programming & Data Structure Laboratory. Day 2, July 24, 2014

Programming & Data Structure Laboratory. Day 2, July 24, 2014 Programming & Data Structure Laboratory Day 2, July 24, 2014 Loops Pre and post test loops for while do-while switch-case Pre-test loop and post-test loop Condition checking True Loop Body False Loop Body

More information

Computer Science III WEEK4 Dr.Elgin KILIÇ

Computer Science III WEEK4 Dr.Elgin KILIÇ Computer Science III 2018-2019 LOOPS FOR LOOP STATEMENT WEEK4 Dr.Elgin KILIÇ A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number

More information