C'est les choses dans ma tête.

8.1.06

First C++ Program

I went to Borders late last night. I finally had a golden opportunity to use my Christmas money. My mom couldn't complain either, I mean, it's books!

So, I looked around for a bit. I looked in the manga section, and picked up Chobits Vol. 3-6. Since I had my 30% coupon, it wouldn't be such a big dent in my piggy bank. I passed my mom and sister, and they said it was about time to leave, but I had one more thing to check up on first, computer books. I went straight there, and looked through them, quickly. I scanned and saw C# programming books. I though, "Hmmm, I had to return the C# programming book to the library, so I don't have such a good resource for programming anymore." I checked the price. $25. "That's a good price, I wonder..." My eyes scanned to the next section of programming books, it was C++. "I've been wanting to learn C++, maybe I should get this instead." So, I put the C# book back and pick up the C++ book, still only $25.

I sped to put back all but one of the Chobits books. I kept vol. 3. I went to the check out. Right before handing the cashier the coupon I had, I noticed that it said "30% off one book." Heh heh, good thing I put back those Chobits, and I got something that will earn me more of a discount, eh?

So, I get home and start into my C++ book. I read, read, read. I soon come to a section where it says to type what is written in the box into the source code editor. So, I copy down exactly what the book says to. This copying was rather good, I got to see and remember the elements of a basic C++ program. Since I don't quite consider copying actually writing your own, this program didn't count. After countless errors, and rude forum folk, I got this program to run. FINALLY!

Now, since I wanted to create my own program that was 100% original, I started thinking through common math formulas. The Pythagorean Theorem popped into my head, so I decided that I would write a program that would solve for side 'c' of the Pythagorean Theorem. I did the 'a' squared and 'b' squared parts of the coding quickly, without errors. Soon, it was time for the square root. Unfortunately, I haven't gotten to any part in my book yet that discusses how to square root with C++ coding, so I searched the net, and soon found what I was looking for.

Now, I have my completed 'Pythagorean Theorem' program! Feel free to use it, distribute it, whatever, I don't care. But, if you can somehow find a way to scam people, and sell it, please give me some of your funds.. heh heh.

Here is the program: Pythagorean Theorem.

Enjoy <(^_^)>

No comments:

Dessart in the Desert © 2007 by Ryan Alspaugh