17 views

Uploaded by Amr Mahmoud Ezzat

computer project documentation

- Https Bluejforicse Wordpress Com Arrays
- Most Common Programming Questions in the Interviews About Data Structures
- Learning to Program With Haiku Lesson 5
- module xxx
- dmo(1)
- Sacs Manual - Sacv IV
- Terministic Random Number Generator Algorithm
- openxlsx
- Intro Blender 2
- student teaching- coordinate plane lesson plan 3
- Earthworm Excel Activity
- computation calculator
- 10-11 SM2 Final
- RedCrab 4.47 Manual en News
- frame3dd
- main
- Analytic Geometry
- Intelligent Two-Axis Dual-ccd Image-servo Shooting Platform Design
- Lecture 02
- RPGLE Reference Manual

You are on page 1of 4

Design a software tool for Equation Drawing. The input to the software tool is

a string containing the Equation (Composed of Polynomials) and the output is

the Drawing of the equation using the Graphics Library provided by the text

book author.

Design

The project is divided into five stages as shown in Figure 1:

1. String input

2. String parsing

3. Drawing the function

4. Get a point

5. Zoom in or Zoom out

Implementation details

1. String Parsing:

Its the process of converting the string from text (characters) into two arrays of doubles which

represent the values of the powers and the coefficients of the terms.

The main function used for parsing is strtod .This function converts the string into double until it finds

strange character (not in the range 0-9) and it takes two parameters:

1) A pointer which indicates the start of the string to be converted into a double value

2) A pointer where the address of the strange character is saved. For this program this strange

character is either +- or (.

At first the user enters a string in the form (y=a

0

x

n

+a

1

x

n-1

+.+a

n

) where a

0

, a

1

,, a

n

are constants and n

is less than or equal 10.

The pointer used in this function is called pEnd and its address is initially the address of the first

character of the string.Then a while loop is used to extract the coefficient and the power of each term

from the string .The while loop ends when the address of pEnd is larger than the address of the last

element of the string.

The function strtod is used to extract the coefficient of the first term and its return value is saved into

the first element of the coefficient array.

Then the compiler checks the value of the strange character that ended the function:

If this character is ( ,this means that this term is multiplied by a certain power of x.So pEnd points

to the first element of this power skipping (x^ using pEnd += 3.Then the function strtod is used again

saving its return value to the first element of the power array.The address of pEnd is then incremented

by one in order to point to the sign of the next term(if it exists).

For any character rather than (which may be + or , the value of the first element of the power

array equals 0.

At the end of each loop the value two following elements of power and coefficient arrays are ready to

be assigned with values.

By the end of the while loop, we have two double arrays of both coefficients and powers of the terms.

difficulties :

we have first tried to do string parsing manually using .find and .substring but this concluded with

some problems which were that the program couldn't read a coeff with no powers or a coeff with no

brackets so we came up with many conditions and at last this only helped us with reading only one coeff

with no brackets nothing more..

so then we searched for some functions which would make it easier .. so we came up with strtod

function ..which helped us in reading as many non power coeff as the user would enter ad also

minimizing the code of string parsing to less than 40 lines of code .. and made it much easier to

comprehend if compared to the first manual method .

2. Drawing the grid lines:

This stage includes drawing the grid lines ,the X-axis and the Y-axis.

First of all, We draw the grid lines. By using a for loop, Successive vertical lines are drawn from the

bottom of screen till its top and successive horizontal lines are drawn from the left of the screen till its

right. This stage also includes printing numbers showing the grading of both X and Y axes.

Secondly we draw the x-axis and y-axis making them thicker than the rest of the grid lines. A for

loop is used to draw vertical and horizontal lines, just like the one used for drawing the grid lines. The

increment at the end of each loop is small such that the drawn lines are too near and appear to be one

thick line.

drawing the X letter and the Y letter on their axis but making their drawing dependant on the axis

to help us in the zooming functions

3) Drawing the function :

identifying a variable x1 and initializing it to -coordinate (which in the normal zoom made is equal to 10)

then identifying another variable y1 and initializing it to zero and indenting a counter .i = 0 which will

run until 10 ...we then begin our 2 for loop ..nesting a small for loop within other big one

{

{ making y1 += coef[i] * pow(x1, por[i]) so that in each small loop .i will inc by 1 till 10 passing by all your

ten coeff and your ten powers( which the program has saved them from the string input function)and

getting the submission of all y1 so that at the end you get only one y1 for only one x1}

then x1 will inc by 0.001 getting another point of x then the previous small for loop repeats it self again

to get the new y1 for the new x1

}

this all happens until x1 becomes equal to the initial positive coordinate ..we made inc x1 very small in

order to get many points closer to each other so as if to make the user sees them as a continuous

function while in fact they are nothing but many separate points drawn within a specific function

Testing

Tool limitations

The input should written in a specified way starting with 'y=' and each power is written

between two brackets (x^n) without any spaces between the characters.

The number of terms entered by the user can't exceed 10 terms

There is a limit to the zoom-in feature (coordinates can't be negative).

Zoom --input 10 termszoom in coord>0--

Future Work

The program can be edited such that:

The user can enter two functions to be drawn showing their intersection.

The program has better interface.

The program can specify whether the function is even or odd.

Functions(sine &cosine)Max & Min Domain & range Even or odd functions Enter 2 equations and

find s.s --

References

Big c++ - cplusplus.com

- Https Bluejforicse Wordpress Com ArraysUploaded byShivam Raj
- Most Common Programming Questions in the Interviews About Data StructuresUploaded byHector Triana
- Learning to Program With Haiku Lesson 5Uploaded byboromil
- module xxxUploaded byapi-454303170
- dmo(1)Uploaded byMariel Pastolero
- Sacs Manual - Sacv IVUploaded byChristian Ammitzbøll
- Terministic Random Number Generator AlgorithmUploaded bynuaimat
- openxlsxUploaded byPedroM.F.Nakashima
- Intro Blender 2Uploaded byJay Mesa
- student teaching- coordinate plane lesson plan 3Uploaded byapi-346526495
- Earthworm Excel ActivityUploaded byjheil65
- computation calculatorUploaded byMofoleni Bolabi Coloni II
- 10-11 SM2 FinalUploaded byodai1gor
- RedCrab 4.47 Manual en NewsUploaded byNic
- frame3ddUploaded bysompongt
- mainUploaded byapi-346895508
- Analytic GeometryUploaded byAparupa Dasgupta
- Intelligent Two-Axis Dual-ccd Image-servo Shooting Platform DesignUploaded byInternational Journal of Research in Engineering and Technology
- Lecture 02Uploaded byshahnawaz_javed
- RPGLE Reference ManualUploaded byNiraj Jajodia
- Qualitative Analysis Presentation (2)Uploaded bySumeer Shafiq
- 1-s2.0-S0732118X13000354-main.pdfUploaded byjan_kratky4042
- DS Lab AssignmentUploaded byVaibhav Bansal
- Reserved WordsUploaded bySanjana D'souza
- 2016 Acjc h2 Math Prelim p2 QpUploaded byShu Qing Ng
- Variables and Patterns BookUploaded byLorena Carrillo López
- unit 7-standardsUploaded byapi-302577842
- Module CARE Paper2@Set3Uploaded byHayati Aini Ahmad
- excel 2007 tutorial.pdfUploaded byChetan B Arkasali
- 2099_How to Choose Good ProblemUploaded byMarcos Roberto

- fhe_catalog.pdfUploaded byMehdi Hajd Kacem
- Fire Test Cert API 607 6th Ed 8in 900cls Ball ValveUploaded bystrahor7492
- Managing Server Startup and Shutdown for Oracle WebLogicUploaded byAlina Anchidin
- PreStress Concrete 1C-4Uploaded byArman201
- Manual Kit Akron FlowUploaded byTomas Gaviria Martinez
- Paper 2 May 2006 PhysicsUploaded bysolarixe
- Ses-cdegs 2k - InstallUploaded byGilberto Mejia
- TSA ENVIRONS LTD1630kg10stop(kohler).docUploaded bykhalilur rahman
- Caspiche Discovery History PaperUploaded byXavier Toledo
- محاضرات هندسة الاساسات د. طارق نجيب P3Uploaded byHasan
- Fundamental Considerations of Three-Level DC–DC ConvertersUploaded byEric Morisset
- Data Communication SyallbusUploaded bySapna
- Print Ability Ink CoatingUploaded bypakde jongko
- Brasfield-Gorrie-Case-Study.pdfUploaded byRicardo Díaz G.
- oratop (1)Uploaded byjonytapia
- Configuring the GNS3 Router SimulatorUploaded byClimaco Ichigo
- AutoSim Manual ENGUploaded byLee Tai Po
- Bro Aero Herouav 14 Rev 1.19Uploaded bymax72ggo
- Vulnerability of SSL to Chosen Plaintext Attack.pdfUploaded byElsa Cristina David
- type of gas carriersUploaded byArun Iyer
- React IndepthUploaded byWagner Rodrigues
- STUXNET, DUQU and BeyondUploaded byInternational Journal of Science and Engineering Investigations
- BLRBAC Emergency Shutdown Procedure (February 2012)Uploaded bySubburajMech
- Section 12 QuizUploaded bysinta indriani
- Hydropower Plant Pump EnglischUploaded byAnonymous CgFsILbea
- Copy of Motor Feeder Cable & Cable Tray Sizing and DataUploaded byabdkha8644
- Divide and Conquer Algorithm Design MethodUploaded byEbmesem
- Oil regeneration plants by GlobeCore GmbHUploaded byOksana Bichurina
- Effects of Fluoride on BoneUploaded bydrnuha3
- ohwlUploaded bySujana Bandung