| | |
Draw sin curve w/ user input, how to code sin()?
![]() |
•
•
Join Date: Nov 2004
Posts: 5
Reputation:
Solved Threads: 0
I am trying to get a program to draw a sine curve (from 0 to 2pi). It takes 8 lines to draw the complete curve. However, the user can choose to use up to 100 lines to make the curve smoother. How do I get the program to calculate that? I thought of using a counter to count through until it gets to the number of user chosen lines (m_iSample), but then I don't know how to calculate it. I just finished trig too, darn it.
for (count = 0; count<=m_iSample; ++count) {
double iSinValue=sin(count * PI);//do the sin calculation
int iFinalSinValue=iSinValue * 200;//convert result so that it will display correctly
pDC->LineTo( ??? , iFinalSinValue);//draw the line
}
Thanks Again!
Reagan
for (count = 0; count<=m_iSample; ++count) {
double iSinValue=sin(count * PI);//do the sin calculation
int iFinalSinValue=iSinValue * 200;//convert result so that it will display correctly
pDC->LineTo( ??? , iFinalSinValue);//draw the line
}
Thanks Again!
Reagan
![]() |
Similar Threads
- Tutorial: User Input: Strings and Numbers [C++] (C++)
- A few user input questions (C++)
- To find the Sin value , give me a small support (C++)
- User Input Problems (C)
- Complete C Program to draw a sin curve without any application (C)
- user input choosing attribute (Python)
- Help using an Array (C)
Other Threads in the C Forum
- Previous Thread: Help with UNIX more c code
- Next Thread: help with significant figure function
| Thread Tools | Search this Thread |
* ansi api array arrays bash binarysearch calculate centimeter changingto char character convert copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic fflush file floatingpointvalidation fork forloop frequency function getlasterror getlogicaldrivestrin givemetehcodez graphics gtkgcurlcompiling gtkwinlinux hardware highest histogram homework i/o ide inches initialization intmain() iso km license linked linkedlist linux linuxsegmentationfault list logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string suggestions test unix urboc user variable whythiscodecausesegmentationfault win32api windows.h windowsapi





