| | |
Draw sin curve w/ user input, how to code sin()?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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
Views: 6386 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays bash binarysearch centimeter char character convert copyanyfile copypdffile createcopyoffile createprocess() csyntax directory drawing dynamic executable feet fflush fgets file floatingpointvalidation fork frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o ide infiniteloop initialization interest intmain() kilometer lazy license linked linkedlist linux linuxsegmentationfault list match matrix meter microsoft multi mysql oddnumber odf open openwebfoundation pattern pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scheduling segmentationfault send shape single socketprogramming spoonfeeding stack standard strchr string strings structures student suggestions system test testautomation unix urboc user voidmain() win32 win32api windows.h





