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

The first program I ever wrote was...

Page 1 of 1

5 Replies - 1062 Views - Last Post: 01 June 2009 - 07:12 PM

#1 monkey_05_06  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 105
  • Joined: 26-August 06

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

Posted 17 May 2009 - 05:59 PM

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:

y = mx + b


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

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, B) 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:

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. ;)

This post has been edited by monkey_05_06: 18 May 2009 - 12:11 PM


Is This A Good Question/Topic? 0
  • +

Replies To: [Tegan and Sara] The First [Program...]

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

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

Posted 17 May 2009 - 10:01 PM

Lets keep programming topics out of the caffeine lounge please.
Was This Post Helpful? 0
  • +
  • -

#3 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

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

Posted 18 May 2009 - 06:34 AM

Why not place this in the tutorials?
Was This Post Helpful? 0
  • +
  • -

#4 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 396
  • View blog
  • Posts: 2,914
  • Joined: 18-September 06

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

Posted 18 May 2009 - 08:51 AM

My first program was a random number generator (aka, a Dice Roller)

And, it can be seen in all it's glory here. :D

This post has been edited by Bort: 18 May 2009 - 08:51 AM

Was This Post Helpful? 0
  • +
  • -

#5 monkey_05_06  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 105
  • Joined: 26-August 06

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

Posted 18 May 2009 - 12:07 PM

View PostNickDMax, on 17 May, 2009 - 09:01 PM, said:

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.
Was This Post Helpful? 0
  • +
  • -

#6 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

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

Posted 01 June 2009 - 07:12 PM

This topic is in the right place I think. :P

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 :P so it hasn't really been that long.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1