My Journy Into Programming
+6
Lord Pheonix
BBJynne
L0d3x
Toaster
Dud Doodoo
CivBase
10 posters
Page 1 of 1
My Journy Into Programming
So, after wanting to learn C++ for about a year, I finally bought a C++ For Dummies book about a month ago. Since then, I have been reading it... and rereading it. Hey, it's hard to learn a programming language when you haven't even bothered to install the compiler yet . So, I installed the compiler yesterday and backed it up on my jump drive and today at school I made my first program!
It's brain-dead-simple and isn't exactly a Photo Shop or a revolutionary new software... but it's a start. You can download it here. Basically, it just averages the numbers you punch in. If you've got any simple improvements for the program, it'd be appreciated. Otherwise, I'm going to continue my reading and hopefully be able to do more than this by the end of the next few weeks.
It's brain-dead-simple and isn't exactly a Photo Shop or a revolutionary new software... but it's a start. You can download it here. Basically, it just averages the numbers you punch in. If you've got any simple improvements for the program, it'd be appreciated. Otherwise, I'm going to continue my reading and hopefully be able to do more than this by the end of the next few weeks.
Re: My Journy Into Programming
You're really behind, I was creating dynamic runescape macros when I was 11.
Re: My Journy Into Programming
lol, sry if my simpleness does not please you. I didn't even have high-speed internet at 11.
Re: My Journy Into Programming
dud wrote:You're really behind, I was creating dynamic runescape macros when I was 11.
Get over yourself
Toaster- Lord's Personal Minion
- Number of posts : 2715
Age : 30
Location : Ohio
Registration date : 2008-06-19
Re: My Journy Into Programming
When I was 11 I was actually playing outside with other kids.
Civ: here's a great tutorial site for C++ that I used a while ago when learning it myself
http://www.cplusplus.com/doc/tutorial/
And yea, it's the first one that pops up on google, but it's there for a reason.
If you ever get far enough that you wanna mess around with Direct3D, I can give you great links to that stuff too. Same goes for game physics.
Civ: here's a great tutorial site for C++ that I used a while ago when learning it myself
http://www.cplusplus.com/doc/tutorial/
And yea, it's the first one that pops up on google, but it's there for a reason.
If you ever get far enough that you wanna mess around with Direct3D, I can give you great links to that stuff too. Same goes for game physics.
L0d3x- Minion
- Number of posts : 162
Registration date : 2009-01-10
Re: My Journy Into Programming
you were playing runescapeDud Doodoo wrote:You're really behind, I was creating dynamic runescape macros when I was 11.
your point is invalid
BBJynne- The Lord's Blood Knight
- Number of posts : 5059
Age : 31
Registration date : 2008-03-24
Re: My Journy Into Programming
He was playing runescape SO much that he created a VERY dynamic macro for it lol
Re: My Journy Into Programming
so that he could play while he played
KristallNacht- Unholy Demon Of The Flame
- Number of posts : 5087
Location : San Diego, California
Registration date : 2008-06-24
Re: My Journy Into Programming
and game while he games
Last edited by Lord Pheonix on Sat Feb 14, 2009 9:05 pm; edited 1 time in total
Re: My Journy Into Programming
At least he doesn't have malaria...Dud Doodoo wrote:You're really behind, I was creating dynamic runescape macros when I was 11.
Anyway, does anyone know where I can get a free(and preferably legal) graphic design/programming software?
PiEdude- Crimson Jester
- Number of posts : 4573
Age : 31
Location : In the middle of a hollowed crust.
Registration date : 2008-03-24
Re: My Journy Into Programming
I know free. but I've never heard of any good legal free ones
KristallNacht- Unholy Demon Of The Flame
- Number of posts : 5087
Location : San Diego, California
Registration date : 2008-06-24
Re: My Journy Into Programming
This thread made my eyes water it was really funny
But I'll probably use it as a reference since I am trying to do this sorts stuff soon
But I'll probably use it as a reference since I am trying to do this sorts stuff soon
kslidz- Minion
- Number of posts : 753
Age : 32
Location : your pants
Registration date : 2009-02-13
Re: My Journy Into Programming
Actually the macro was meant so I could leave it and it would play for me so I could say i was a level 126.KristallNacht wrote:so that he could play while he played
Those days are over, but I did do some pretty complex programs in pascal.
Re: My Journy Into Programming
*is trying to figure out a way to simplify fractions*
I think I've got it... but there's an error I can't seem to figure out. If anyone's got a simple method to simplify fractions that can be written out in math terms, that'd be helpful.
I think I've got it... but there's an error I can't seem to figure out. If anyone's got a simple method to simplify fractions that can be written out in math terms, that'd be helpful.
Re: My Journy Into Programming
Just find the greatest common divisor and divide numerator and denominater by it.
(I hope I'm not mixing up my mathematical terms here, remember english != primary language)
(I hope I'm not mixing up my mathematical terms here, remember english != primary language)
L0d3x- Minion
- Number of posts : 162
Registration date : 2009-01-10
Re: My Journy Into Programming
So, you've invented the calculator. Congratulations.
LH Justin- Crimson Annoyance
- Number of posts : 700
Age : 29
Location : United States
Registration date : 2008-07-14
Re: My Journy Into Programming
Eh, its a common example to get people started.
I still remember the days that I made syntax errors :'(
I still remember the days that I made syntax errors :'(
L0d3x- Minion
- Number of posts : 162
Registration date : 2009-01-10
Re: My Journy Into Programming
Well, I tried this. Finding the greatest common factor is the hard part though...L0d3x wrote:Just find the greatest common divisor and divide numerator and denominater by it.
(I hope I'm not mixing up my mathematical terms here, remember english != primary language)
I'll post the test code I made for this.
- Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// initialize the remainder veriable
int remain = 0;
// initialize the denominator
int denom = 0;
// imput the values for remain and denom
cout << "Enter a numerator: ";
cin >> remain;
cout << "Enter a denominator: ";
cin >> denom;
// initialize the incrament veriable used for the loop
int i = 2;
while (true)
{
for ( ; denom % i == 0 ; )
{
if (remain % i == 0)
{
break;
}
else
{
i = i + 1;
continue;
}
}
}
// divide the remainders by the greatest common
// factore and assign them to the Show veriables
int remainShow = remain / i;
int denomShow = denom / i;
// display the results
cout << "The simplified fraction is: "
<< remainShow
<< "/"
<< denomShow
<< ".\n";
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
When I enter the second number, it just stops working. Any idea what's wrong?
If you want to see for yourself, you can download the .exe here.
Re: My Journy Into Programming
What's up with that weird loop? The problem you are getting is that you get stuck in an infinite loop. The while(true) will ALWAYS keep repeating the for loop inside. The break statement you use in the for loop will ONLY break out of the for loop, not the overhead while loop.
Try the following instead of the while and for loop, also remove the first i = 2 statement (the one just before your while loop started):
for (int i = 2 ; denom % i == 0 ; i++)
{
if (remain % i == 0)
{
break;
}
}
Let me know if that works.
Try the following instead of the while and for loop, also remove the first i = 2 statement (the one just before your while loop started):
for (int i = 2 ; denom % i == 0 ; i++)
{
if (remain % i == 0)
{
break;
}
}
Let me know if that works.
L0d3x- Minion
- Number of posts : 162
Registration date : 2009-01-10
Re: My Journy Into Programming
Well, it worked... sort of. I complied it and here's what I got.
*goes back to scan through the program several times until I can figure out what's wrong*
You know... now that I think of it... why did I decide to use an infinite loop?
EDIT:
I think I figured out what's wrong.
First, it declares the i veriable and sets it equal to 2. Then it checks to see if denom % i == 0. Then it checks to see if remain % 1 == 0. Then, if neither of those work, it incraments i and restarts. Problem is, if remain % i == 0, then it breaks (even if denom % i is not zero). Am I right?
I'll keep working on it.
EDIT AGAIN:
So I changed it to this:
It still spits out the wrong fraction though...
EDIT AGAIN AGAIN:
And ithe same problem from before happens when I enter 2/4. In fact, it does that with every fraction I enter that should be 1/2.
- Code:
Enter a numerator: 10
Enter a denominator: 15
The simplified fraction is: 5/7.
Press any key to continue . . .
*goes back to scan through the program several times until I can figure out what's wrong*
You know... now that I think of it... why did I decide to use an infinite loop?
EDIT:
I think I figured out what's wrong.
First, it declares the i veriable and sets it equal to 2. Then it checks to see if denom % i == 0. Then it checks to see if remain % 1 == 0. Then, if neither of those work, it incraments i and restarts. Problem is, if remain % i == 0, then it breaks (even if denom % i is not zero). Am I right?
I'll keep working on it.
EDIT AGAIN:
So I changed it to this:
- Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// initialize the remainder veriable
int remain = 0;
// initialize the denominator
int denom = 0;
// imput the values for remain and denom
cout << "Enter a numerator: ";
cin >> remain;
cout << "Enter a denominator: ";
cin >> denom;
int i = 2;
for (; ;)
{
if (denom % i == 0)
{
i = i + 1;
continue;
}
if (remain % i == 0)
{
break;
}
}
// divide the remainders by the greatest common
// factore and assign them to the Show veriables
int remainShow = remain / i;
int denomShow = denom / i;
// display the results
cout << "The simplified fraction is: "
<< remainShow
<< "/"
<< denomShow
<< ".\n";
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
It still spits out the wrong fraction though...
EDIT AGAIN AGAIN:
And ithe same problem from before happens when I enter 2/4. In fact, it does that with every fraction I enter that should be 1/2.
Re: My Journy Into Programming
Hmm I didn't examine your algorithm, and don't really feel like going through it.
But there's a very common method used for calculating the GCD, I think it's called Euler's algorithm or something and it's really easy to implement.
I suggest you use that one. Wikipedia should give you the stuff you need.
But there's a very common method used for calculating the GCD, I think it's called Euler's algorithm or something and it's really easy to implement.
I suggest you use that one. Wikipedia should give you the stuff you need.
L0d3x- Minion
- Number of posts : 162
Registration date : 2009-01-10
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|