Title of project: pendulum waves. Pendulums Waves Pendulums Waves.

Slides:



Advertisements
Similar presentations
 putpixel function plots a pixel at location (x, y) of specified color.  Declaration :- void putpixel(int x, int y, int color);
Advertisements

BGI graphics library And Visual Studio.
Graphics in MS-DOS Environment LEE HUN HEE. 1.Real Coordinate and Windows Coordinate ● Real Coordinate ->(x,y) ● Windows Coordinate ->(wx,wy) ∴ (x,y)->(wx,wy)
Strings.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Characters and Strings.
Current Assignments Homework 5 will be available tomorrow and is due on Sunday. Arrays and Pointers Project 2 due tonight by midnight. Exam 2 on Monday.
Assembly Language Working with the CPU.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 8 - Characters and Strings Outline 8.1Introduction 8.2Fundamentals of Strings and Characters 8.3Character.
Chapter 10.
Overview creating your own functions calling your own functions.
C++ Graphics Primitives April 15th. void clearscreen(int c) –clear the screen to background color c –If c = 1 screen black.
1 CS 177 Week 15 Recitation Slides Review. Announcements Final Exam on Sat. May 8th  PHY 112 from 8-10 AM Complete your online review of your classes.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 8 - Characters and Strings Outline 8.1Introduction 8.2Fundamentals of Strings and Characters 8.3Character.
Program Input and the Software Design Process ROBERT REAVES.
EPSII 59:006 Spring Introduction Fundamentals of Strings and Characters Character Handling Library String Conversion Functions Standard Input/Output.
Lab 5: drawing and output User Interface Lab: GUI Lab Sep. 25 th, 2013.
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 8 - Characters and Strings Outline 8.1Introduction 8.2Fundamentals of Strings and Characters 8.3Character.
Graphics in C language Lecture by Jameel Asghar IT Manager Department of CS&IT NED University of Engineering and Technology, Karachi.
Continuous February 16, Test Review What expression represents the zip car eligibility rules of at least 18 years old and no incidents?
GRAPHICS AND MOUSE PROGRAMMING IN C. Turbo C has a good collection of graphics libraries. If you know the basics of C, you can easily learn graphics programming.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Switch Statement in C++. Syntax switch (selector) { case L1: statements1; break; case L2: statements2; break; … default: statements_n; } Semantics: This.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
VHDL FLI. FLI Definition FLI routines are C programming language functions that provide procedural access to information within the HDL simulator.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
Chapter 2 Web Page Design Mr. Gironda. Elements of a Web Page These are things that most web pages use.
Fundamentals of C and C++ Programming. EEL 3801 – Lotzi Bölöni Sub-Topics  Basic Program Structure  Variables - Types and Declarations  Basic Program.
Chapter 4: Subprograms Functions for Problem Solving Mr. Dave Clausen La Cañada High School.
CSE 232: C++ debugging in Visual Studio and emacs C++ Debugging (in Visual Studio and emacs) We’ve looked at programs from a text-based mode –Shell commands.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
Computer Graphics Prepared By: Bahram Taheri Sept Amirkabir University of Technology & Birmingham University.
Chapter 13 – C++ String Class. String objects u Do not need to specify size of string object –C++ keeps track of size of text –C++ expands memory region.
Pointers A pointer is a variable that contains a memory address as it’s value. The memory address points to the actual data. –A pointer is an indirect.
1 Guide to Oracle10G CHAPTER 7: Creating Database Reports 7.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 More details and explanation …
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Calling Methods. Review  We can declare and create objects: Dinosaur dino; dino = new Dinosaur();  We can also shortcut the first two lines: Dinosaur.
NoufNaief.net TA: Nouf Al-harbi.
Validation final steps Stopping gaps being entered in an input.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 2 – Welcome Application Introduction to Graphical.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Computer Science I Variables. Methods. Classwork/Homework: Re-do or do new drawing using variables & function(s). Zip folder and upload to Moodle dropbox.
Objects and Classes Start on Slide 30 for day 2 Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Much of.
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
C++ Programming Lecture 19 Strings The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
1 Introduction to PostScript Sep. 21 Dae-Eun Hyun 3D MAP Lab.
Lecture 5 Computer programming -1-. Input \ Output statement 1- Input (cin) : Use to input data from keyboard. Example : cin >> age; 2- Output (cout):
Characters and Strings
Review Expressions and operators Iteration – while-loop – for-loop.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Processing  Install Processing  Learn how to edit, run, save, export,
CS162 External Data Files 1 Today in CS162 External Files What is an external file? How do we save data in a file?
LESSON 2 Basic of C++.
Text Reader And Typer Project By: Brandon Smith. What it does ● First, a picture containing text is used as an input. ● The program scans it for distinct.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
VG101 RECITATION 5 By TAs. CONTENTS How to read Vg101Class.h Samples about graphics About assignment 5 Array.
Final Project Virtual Slot Machine. By: Bander Alrogi Khaled Al Nuaimi Mohammed Almajhad Metaib Al-Enzai Course Title: ECE 2552 Instructor: Dr Kepuska.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
The C++ Program Structure
Chapter 2 Elementary Programming
Enum ,Char Functions& Math Library Functions I.Mona Alshehri
Lecture No 9 Graphics.
CS 177 Week 15 Recitation Slides
Homework Applied for cs240? (If not, keep at it!) 8/10 Done with HW1?
C++ Programming Lecture 20 Strings
Presentation transcript:

Title of project: pendulum waves

Pendulums Waves Pendulums Waves

To start a graphic program first we should include some graphics library #include #include”winbgim.h” To run this program, you need graphics.h header file, graphics.lib library file and Graphics driver (BGI file) in the program folder.

After we write int main we need to type these 2 lines int gd=DETECT,gm=0; initgraph(&gd,&gm,""); Dont forget to write DETECT with capital letters. These 2lines enable us to enter to the graphic page.

InitGraph: Initializes the graphics system. Declaration: void far initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver); Remarks: To start the graphics system, you must first call initgraph. initgraph initializes the graphics system by loading a graphics driver from disk (or validating a registered driver) then putting the system into graphics mode. initgraph also resets all graphics settings (color, palette, current position, viewport, etc.) to their defaults, then resets graphresult to 0. Arguments:

gd:*graphdriver: Integer that specifies the graphics driver to be used. You can give graphdriver a value using a constant of the graphics drivers enumeration type. gm:*graphmode : Integer that specifies the initial graphics mode (unless *graphdriver = DETECT). If *graphdriver = DETECT, initgraph sets *graphmode to the highest resolution available for the detected driver. You can give *graphmode a value using a constant of the graphics_modes enumeration type. pathtodriver : Specifies the directory path where initgraph looks for graphics drivers (*.BGI) first. If they're not there, initgraph looks in the current directory. If pathtodriver is null, the driver files must be in the current directory. This is also the path settextstyle searches for the stroked character font files (*.CHR).

If u want to draw a line u should write this order line(int x0,int y0,int x1,int y1); x0,y0 are coordinate of the first of line &x1,y1 are coordinate of last of line If u want to draw a circle u should write this order circle(int x,int y,R); R is radius of circle &x,y are coordinate of center of circle.

We need to use arrays to introduce x[i],y[i],l[i]. we need arrays to make our codes easier to write. At first of my code I want u to input the number of pendulums.

To calculate the length of pendulums we know 16T=17Ta,16T=18Tb,… so La=(16/17)^2 L,… so if we have the length of L we can calculate the other length. That I use for loop for it.

Each pendulums in the t s second is in the place which the coordinate of x is x=Asin(wt) &we can calculate the coordinate of x,y. To change the color of pen we use: setcolor(i); 0=<i<=15

In each loop I draw pendulums & I use this order to delay for alittle time. Delay(milli second); & after that I earase the pendulums by: cleardevice(); which clear the page. In each loop I draw pendulums & I use this order to delay for alittle time. Delay(milli second); & after that I earase the pendulums by: cleardevice(); which clear the page.

How to Fix the flickerings? To fix the flickerings we need to draw a picture in one page & draw next picture on the other page & change the page in each loop. The orders are setactivepage(int x); setvisualpage(int x);

In each loop,we substract from the amplitude of pendulums,if(amplitude==0) break;

We can write a text in graphic page by: settextstyle(int x,int y,int z); x=change the kind of writting y z=size of text outtextxy(int x,int y,” text ”);

Thanks from Dr.Bahrami Mojdeh karbalaee Motalleb Good luck!