learning programming

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
lodara
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 7
Joined: Tue Jun 08, 2010 7:41 pm
Current Project: learning
Favorite Gaming Platforms: xbox 360, xbox, play station2
Programming Language of Choice: c++

learning programming

Post by lodara »

I made this to track my progress in learning how to program
June 9 2010-i read like 2 chapters of "c++ without fear". spent like 3hr (or more a lot more)trying to figer out Microsoft visual c++ 2010, and learned that a clr console app is different from a win32 console app. I made yet another hello world program. made a program that converts Fahrenheit to Celsius and vice verse.learned about data types made a program that determines if a number is even or odd. learned how to make a loop program and made a program that loops till it gets to your number. then finished off by making a program that determines weather a number is prim or not prime. More to come

June 10 2010-i made a program that loops till it hits your numbers using the statement for, i also declared the i int after declaring the other ints. n1 and n2

Code: Select all

#include "stdafx.h"
#include <iostream>
using namespace std;
int main(){
	int  n1, n2;
		cout << "enter a number and press enter.";
		cin >> n1;
		cout << "now enter a number that is grater than the last and press enter.";
		cin >> n2;
			for (int i=n1; i<=n2;i++)
				cout << i << " ";
		return 0;
}
ibly31 wrote:Add this to your todo list: Learn how to use punctuation to stop run on sentences.
i didnt put punctuations because i did the post on my phone and i was lazy
Last edited by lodara on Thu Jun 10, 2010 9:35 am, edited 5 times in total.
I did it just to see
Image
i think i win
User avatar
ibly31
Chaos Rift Junior
Chaos Rift Junior
Posts: 312
Joined: Thu Feb 19, 2009 8:47 pm
Current Project: Like... seven different ones
Favorite Gaming Platforms: Xbox 360, Gamecube
Programming Language of Choice: C++, ObjC
Location: New Jersey.

Re: learning programming

Post by ibly31 »

Add this to your todo list: Learn how to use punctuation to stop run on sentences.

Ahh, I kid, I kid. Good job man! That is a lot to learn in such a short amount of time. Keep on working hard and some day you'll be developing programs for a living(if that is what you want)!
Image
Twitter
Website/Tumblr
My Projects

The best thing about UDP jokes is that I don’t care if you get them or not.
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: learning programming

Post by davidthefat »

Just one word of advice, just keep programming. Its how you think, not the codes and syntax. The difference from an artist and a some guy that knows how to use a paint brush is practice and experience. You may know how to use the tools, but does that really make you an artist? There are some tough topics that you would have to wrap your head around, but with more experience, it will get to you eventually...
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: learning programming

Post by GroundUpEngine »

Nice one ;) These are 3 things I try to stick by, if you cbf to read them;
  • Don't stay in your comfort zone, try program new and challenging things rather than write the same old stuff all the time!
  • Try not to copy and paste code too much, instead learn and understand the significance of the code and what it's supposed to do..
  • and Don't get lazy, like we all do sometimes hehe :lol:
User avatar
lodara
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 7
Joined: Tue Jun 08, 2010 7:41 pm
Current Project: learning
Favorite Gaming Platforms: xbox 360, xbox, play station2
Programming Language of Choice: c++

Re: learning programming

Post by lodara »

GroundUpEngine wrote:[*]and Don't get lazy, like we all do sometimes hehe :lol: [/list]
ya i know what your saying thanks
ibly31 wrote:And Keep on working hard and some day you'll be developing programs for a living(if that is what you want)!
it is what i want to do some day
davidthefat wrote:Just one word of advice, just keep programming. Its how you think, not the codes and syntax. The difference from an artist and a some guy that knows how to use a paint brush is practice and experience. You may know how to use the tools, but does that really make you an artist? There are some tough topics that you would have to wrap your head around, but with more experience, it will get to you eventually...
deep what you say makes me want to work harder to become that "artist" and develop my skills as a programmer
I did it just to see
Image
i think i win
User avatar
lodara
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 7
Joined: Tue Jun 08, 2010 7:41 pm
Current Project: learning
Favorite Gaming Platforms: xbox 360, xbox, play station2
Programming Language of Choice: c++

Re: learning programming

Post by lodara »

i can not see what the hell is wrong here can some one help me i am trying to make it so it can tell me if a number is prime and if not prime show me what number can go in it

Code: Select all

#include "stdafx.h"
#include <iostream>
#include <math.h>
using namespace std;

void get_divisors(int n);

int main(){
	int i, n;
	cout << "enter a number and press enter: ";
	cin >> n;
	get_divisors(n);
	return 0;
}

void get_divisors(int n){
	int i;
	double sqrt_of_n = sqrt((double) n);
	for (i=2;i<=sqet_of_n; i++)
		if (n%i==0) { 
			cout << i<< " ";
			get_divisors(n/i);
				return 0;
		}
		cout << n; 
}
I did it just to see
Image
i think i win
User avatar
Milch
Chaos Rift Junior
Chaos Rift Junior
Posts: 241
Joined: Sat Jul 11, 2009 5:55 am
Programming Language of Choice: C++
Location: Austria, Vienna

Re: learning programming

Post by Milch »

2 errors here.

Code: Select all

double sqrt_of_n = sqrt((double) n);
   for (i=2;i<=sqet_of_n; i++) //there - it should be sqrt_of_n! 
      if (n%i==0) {
         cout << i<< " ";
         get_divisors(n/i);
            return 0; //You declared the function as void, and wrote 'return 0'. Just write 'return' and it should be okay.
      }
      cout << n;
}
Hope it works now as it should ;D
Follow me on twitter!
User avatar
lodara
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 7
Joined: Tue Jun 08, 2010 7:41 pm
Current Project: learning
Favorite Gaming Platforms: xbox 360, xbox, play station2
Programming Language of Choice: c++

Re: learning programming

Post by lodara »

thanks it worked i didn't see the sqet and when i looked closer i felt like a dumb ass lol :oops:
I did it just to see
Image
i think i win
Post Reply