Welcome to the most active Linux Forum on the web.
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Hi guys, need a little help!!!!!Just started learning C
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 08-10-2005, 02:42 PM #1 MoeedK LQ Newbie   Registered: Aug 2005 Location: Toronto Posts: 2 Rep: Hi guys, need a little help!!!!!Just started learning C I just started learning C. Its pretty good sofar how ever I have an assingment coming up shortly. I do not have any prior programming experience. I am up to arrays...as my learning is going on. Here is the main problem. I have to write a program that takes in a sin and cos equations and illustrates the amplitutes, phase shift, the period of the function, range and horizontal shoft. My question is, where do I start, how do I analyze the equation, second.... will be really hard to make the graphs ? or am I thinking too far ? I only have 6 to 7 weeks left and its either this or a trivia game which looks too easy, I want a challenge but I donot want to choose something that I cannot do in the given time.
 08-10-2005, 03:04 PM #2 lowpro2k3 Member   Registered: Oct 2003 Location: Canada Distribution: Slackware Posts: 340 Rep: For getting started, I find its often easiest to forget programming for a little bit, and work out the logic with a pencil and paper. Once you get it on paper you'll be in a better position to write great code.
 08-10-2005, 03:08 PM #3 MoeedK LQ Newbie   Registered: Aug 2005 Location: Toronto Posts: 2 Original Poster Rep: well the thing is I can solve the equation, I just need a hint on how to get it from user and how to store it. I was thinking of storing it in a string and then take the values. basically: here is wat Ihave so far: y = aSin(bx+c)+d I just need to know a way to get a b c d I am not sure if take it in as a string is cheating.
08-10-2005, 08:41 PM   #5
Hko
Senior Member

Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep:
Quote:
 I have to write a program that takes in a sin and cos equations and illustrates the amplitutes, phase shift, the period of the function, range and horizontal shoft. My question is, where do I start, how do I analyze the equation, second.... will be really hard to make the graphs ? or am I thinking too far ? I only have 6 to 7 weeks left and its either this or a trivia game which looks too easy, I want a challenge but I donot want to choose something that I cannot do in the given time.
To analyse the equation, you'll have to deal with precedence of the operators. Storing them in a tree-structure will help. Subjects to search for, read and learn about (more or less in this order):
• Pointers, struct/s and union's
• Binary trees and recursion
• Recursive descent and expression trees

You'll need to choose and learn about some graphic library ("widget API") to use to draw the graphs. For plain C, the GTK-library or the SDL-library the are the most logical choices IMHO.

SDL is more about game programming, while GTK is more aimed at all kinds of dekstop applications. I'd suggest GTK for this.

Probably a hard job to do in 6, 7 weeks (fulltime?) if still at about 30% percent of learning the C language itself. May be do-able though, depending on your talent, and whether programming is fun to you.

Last edited by Hko; 08-10-2005 at 08:43 PM.

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post einnor LinuxQuestions.org Member Intro 5 01-28-2005 01:32 AM kenscottiii LinuxQuestions.org Member Intro 3 11-28-2004 06:03 AM teachmelinux Linux - Newbie 6 08-14-2004 03:40 AM psiakr3w Programming 7 08-01-2004 05:12 PM dannyflounders Slackware 10 07-29-2003 09:59 AM

LinuxQuestions.org

All times are GMT -5. The time now is 05:08 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -