0 Up votes0 Down votes

17 views4 pagescomputer project documentation

May 20, 2014

computer project

© © All Rights Reserved

DOCX, PDF, TXT or read online from Scribd

computer project documentation

© All Rights Reserved

17 views

computer project

computer project documentation

© All Rights Reserved

- _1 larson sol
- Zycus Infotech Aptitude Question Paper
- Method of Tension Coefficients
- hikers worksheet
- ICE-EM Maths
- LAsdef
- Esp
- coordinate plane lesson plan
- Chapter 4 New
- lec38
- MRSM Maths P1 2007
- PROGRAMMING IN INFOBASIC.docx
- CENG 106 Lab9
- cs173honors2
- Printing _Defining Composites - HM-4000
- PathTracking Report
- orca_share_media1565165258555
- edu 329 lesson plan
- Writing Test Bench
- Exercise Tranformations

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

- _1 larson solUploaded byMike Montoya
- Zycus Infotech Aptitude Question PaperUploaded byJames Ronaldo
- Method of Tension CoefficientsUploaded byPrataprao Patil
- hikers worksheetUploaded byapi-256464200
- ICE-EM MathsUploaded bysquishyapply
- LAsdefUploaded byNguyễn Thành Công
- EspUploaded bysuleman247
- coordinate plane lesson planUploaded byapi-272823486
- Chapter 4 NewUploaded byvaishuraks
- lec38Uploaded bysan540
- MRSM Maths P1 2007Uploaded bymurulikrishan
- PROGRAMMING IN INFOBASIC.docxUploaded byGreeni Marco
- CENG 106 Lab9Uploaded byWassen Hejjawi
- cs173honors2Uploaded byBen 'ny G' Goodman
- Printing _Defining Composites - HM-4000Uploaded byapi-19817003
- PathTracking ReportUploaded byjohn
- orca_share_media1565165258555Uploaded byRonard Oriol
- edu 329 lesson planUploaded byapi-354507459
- Writing Test BenchUploaded byShrinivas Saptalakar
- Exercise TranformationsUploaded byAtikah Yusoff
- Program On DSAUploaded byTushar
- May 2017 - Week 10Uploaded byIntan Nur Dania
- CalcIII_Complete.pdfUploaded bytewodrosadebabay77
- Intro to MatlabUploaded bySayed Al Hasnine
- br3-u2Uploaded byapi-233970717
- tugas1Uploaded bydawfaegweq2
- esci386-lesson11-1DplotsUploaded byKaleab Tekle
- dokumen.tips_005261-unisab-iii-profibus-extended-64-201312.pdfUploaded byRonel Batocabe
- dsum formula.docUploaded bySyed Ali Haider
- Session 12 PLSQL Oracle 10g v1.0Uploaded byLarry Solomon

- Introduction to CortexM3Uploaded bykrish
- 24C08Uploaded byDuy Lê
- APD4 T81 Devmode E RevEUploaded byfernando
- All Technical QuestionsUploaded byVara Bikkina
- Technical Interview Questions and Answers[1]Uploaded byAnonymous d6vkxJ
- 07a40501 Principles of Programming LanguagesUploaded byAadarsh Singh
- Whats NewUploaded bySandro Rodrigo
- PointersUploaded byJunaid Akram
- spra958kUploaded byShelby Perez
- Assembler Language ProgrammingUploaded byhnsmksm
- Maventic GuideUploaded bySourav
- Cs401 Finalterm Solved Subjective With ReferencesUploaded byMuhammad Faisal
- Micro Controllers PPTUploaded byBiswajit Sarkar
- How Memory Allocation worksUploaded bytamzidkhan
- ILE RPGUploaded byNeedhi D Goel
- syllabusUploaded byMohit Singh
- intro_CUploaded byapi-27045848
- C ProgramsUploaded bySheeba Dhuruvaraj
- mca2009-10syallabusUploaded byYudi Foru
- Unit 4 Intermediate Code GenerationUploaded byArshad Ali Baig
- Programming-Theory Questions & AnswersUploaded byNicholas Shanto
- 7.Delegates and EventsUploaded byNaveen Kumar
- Data Structures Multiple Choice QuestionsUploaded byGm Lakshman
- primefaces_users_guide_3_1.pdfUploaded byMatheus Sandrini Rossi
- How to Create a Linked List in CUploaded bypbilian
- lr_cptig.pdfUploaded byHabib
- 70 Pattern tcsUploaded byArpit Gupta
- moreaboutpointers.txtUploaded bysabarin_72
- CobolUploaded byMoulikpl
- jntu EIE syllabusUploaded bysrilatha9

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.