School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,362 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,484 people online right now. Registration is fast and FREE... Join Now!




[Tegan and Sara] The First [Program...]

 

[Tegan and Sara] The First [Program...], The first program I ever wrote was...

monkey_05_06

17 May, 2009 - 04:59 PM
Post #1

New D.I.C Head
Group Icon

Joined: 26 Aug, 2006
Posts: 46


Dream Kudos: 25
My Contributions
I don't know if anybody else listens to Tegan and Sara but it's unrelated. They do have a song titled The First but that's not what this thread is about.

This thread is actually about the first program you've ever written. I of course am referring to something other than a "Hello World!" program; I'm thinking more along the lines of the first program you ever wrote for yourself based on what you'd learned to do. I've been programming actively for over 5 years now and I don't know that much about mainstream programming to be honest since the majority of my work is done with a game engine that has its own language. I do know some C++ and php. Enough to get me by anyway.

I was just thinking last night about the first program that I ever wrote. It was when I was in 9th grade and I wrote a program for my TI-83 graphing calculator. It was a pretty basic concept involving the slope-intercept mathematical formula which reads as:

CODE
y = mx + b


Given this formula, taking the basic principles of algebra we can also solve these:

CODE
m = (y - b) / x
x = (y - b) / m
b = y - mx


Given these four equations with any 3 known variables it would be a simple matter to solve for the fourth and final unknown.

One question that was posed to me by a teach later on that stumped me at the time but occurred to me as I was thinking back on it was, "How can you solve for the slope with only one point?"

Of course looking at the above formulas if X == 0 then there would be a divide by zero error so we can assume a point at (0, cool.gif as well as at (X, Y) which gives the two points needed for the validity of the formula to solve for slope.

So anyway, I just rewrote the program since I no longer had it. Here's the full source:

CODE
ClrHome
Disp "     Y=MX+B","","SOLVES THE SLOPE","    INTERCEPT","   FORMULA FOR","A SINGLE UNKNOWN"
Pause
Lbl W
ClrHome
Menu("WHICH UNKNOWN?","Y",Y,"M",M,"X",X,"B",B)
Lbl Y
ClrHome
Prompt M,X,B
ClrHome
MX+B→Y
Disp "Y=",Y
Pause
Goto A
Lbl M
ClrHome
Prompt Y,X,B
ClrHome
If X=0
Then
Disp "   X MUST BE","    NONZERO","","PLEASE TRY AGAIN"
Pause
Goto M
End
(Y-B)/X→M
Disp "M=",M
Pause
Goto A
Lbl X
ClrHome
Prompt Y,M,B
ClrHome
If M=0
Then
Disp "   M MUST BE","    NONZERO","","PLEASE TRY AGAIN"
Pause
Goto X
End
(Y-B)/M→X
Disp "X=",X
Pause
Goto A
Lbl B
ClrHome
Prompt Y,M,X
ClrHome
Y-MX→B
Disp "B=",B
Pause
Goto A
Lbl A
Menu("AGAIN?","YES",W,"NO",E)
Lbl E
ClrHome
Return


Anyway, I thought it would be interesting to see what some of you wrote as your first useful program. I looked around and didn't see anything like this so sorry if I overlooked it. wink2.gif

This post has been edited by monkey_05_06: 18 May, 2009 - 11:11 AM

User is offlineProfile CardPM
+Quote Post


NickDMax

RE: [Tegan And Sara] The First [Program...]

17 May, 2009 - 09:01 PM
Post #2

Can grep dead trees!
Group Icon

Joined: 18 Feb, 2007
Posts: 5,216



Thanked: 285 times
Dream Kudos: 1175
Expert In: Java/C++

My Contributions
Lets keep programming topics out of the caffeine lounge please.
User is offlineProfile CardPM
+Quote Post

firebolt

RE: [Tegan And Sara] The First [Program...]

18 May, 2009 - 05:34 AM
Post #3

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,463



Thanked: 75 times
Dream Kudos: 1675
My Contributions
Why not place this in the tutorials?
User is online!Profile CardPM
+Quote Post

Bort

RE: [Tegan And Sara] The First [Program...]

18 May, 2009 - 07:51 AM
Post #4

VBort.NET
Group Icon

Joined: 18 Sep, 2006
Posts: 1,353



Thanked: 27 times
Dream Kudos: 350
My Contributions
My first program was a random number generator (aka, a Dice Roller)

And, it can be seen in all it's glory here. biggrin.gif

This post has been edited by Bort: 18 May, 2009 - 07:51 AM
User is offlineProfile CardPM
+Quote Post

monkey_05_06

RE: [Tegan And Sara] The First [Program...]

18 May, 2009 - 11:07 AM
Post #5

New D.I.C Head
Group Icon

Joined: 26 Aug, 2006
Posts: 46


Dream Kudos: 25
My Contributions
QUOTE(NickDMax @ 17 May, 2009 - 09:01 PM) *
Lets keep programming topics out of the caffeine lounge please.


Sorry I didn't think it belonged in the programming help forum simply because I wasn't asking for programming help. I did read over the "NO PROGRAMMING QUESTIONS" but I still thought it was the best forum for the topic as it is a programming discussion not a technical question... My mistake.
User is offlineProfile CardPM
+Quote Post

papuccino1

RE: [Tegan And Sara] The First [Program...]

1 Jun, 2009 - 06:12 PM
Post #6

C# Programmer
Group Icon

Joined: 2 Mar, 2008
Posts: 943



Thanked: 33 times
Dream Kudos: 50
My Contributions
This topic is in the right place I think. tongue.gif

My first actual useful program I built was a movie torrent searcher. I just typed in the movie name and the DVDRip torrent would download. Actually I just made it two weeks ago tongue.gif so it hasn't really been that long.


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 08:14PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month