Page 1 of 1

learning programming

Posted: Wed Jun 09, 2010 10:22 pm
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

Re: learning programming

Posted: Wed Jun 09, 2010 10:59 pm
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)!

Re: learning programming

Posted: Thu Jun 10, 2010 12:05 am
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...

Re: learning programming

Posted: Thu Jun 10, 2010 12:23 am
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:

Re: learning programming

Posted: Thu Jun 10, 2010 11:12 am
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

Re: learning programming

Posted: Sat Jun 12, 2010 11:11 pm
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; 
}

Re: learning programming

Posted: Sun Jun 13, 2010 6:07 am
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

Re: learning programming

Posted: Sun Jun 13, 2010 11:27 pm
by lodara
thanks it worked i didn't see the sqet and when i looked closer i felt like a dumb ass lol :oops: