Jump to content

Hi!

- - - - -

  • Please log in to reply
13 replies to this topic

#1
zodiac

zodiac

    Newbie

  • Members
  • Pip
  • 6 posts
I recently read some stuff about programming and found it really interesting. I basically have no idea about it, so I figured this would be the best way to learn, with people who do know.

I'm currently studying maths and have an obsession with rubik's cubes, so that's what I spend my time on.

That's about it, I hope you guys can help me get started.

Thanks.

#2
TheCompBoy

TheCompBoy

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 272 posts
Welcome to CodeCall! There is plenty of very good programmers here that would be happy to answear your questions!
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/

#3
zodiac

zodiac

    Newbie

  • Members
  • Pip
  • 6 posts
Could someone guide me a little at the beginning? What should I start with? From the very basics, please.

Thanks guys.

#4
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US

zodiac said:

I'm currently studying maths and have an obsession with rubik's cubes, so that's what I spend my time on.

You actually made me get out and solve my Rubik's cube, even though I haven't been using it for some time now. There's this other student at my school who likes Rubik's cubes, he has two 3x3's and a 4x4. I don't know how to solve 4x4 cubes, but I raced with him with 3x3 cubes, and he beat me by about 5 seconds.

Also, math and science are my favorite subjects, though if I had to choose one, math would top the list. I am currently about to transition from the differential calculus class to the integral calculus class; but I do find math and programming related, and even helpful to each other; I think you'll do fine with programming, if you like math, and understand it well.

* * *

As for the little guide, what do you want to do with programming? Do you want to do web server programming, or client-side browser programming, or bare-metal hardware programming, or general-purpose computer programming, or some other type? The language you need to learn depends on what perspective you want to approach this with.

As for a start, I guess I could give you some sample code, etc., to some languages I know, so you can choose which you like better:



Ruby:
Ruby is currently not a language that can be compiled (it's a scripting language), and it can only be run on computers that have the interpreter for it, but it was my first programming language.

Here's a hello.rb example:

puts "Hello, what is your name?" 

name= gets.chomp       # chomp () is not required, but recommended; for more information, ask. 

        # Also note, functions can be called w/out parentheses ( () ). 

if name == "Joe" 

  puts "Great name!" 

elsif name == "Bob" 

  puts "Horrible name!" 

else 

  puts "Hello, " + name + ", how are you?" 

end 


JavaScript:
A scripting language that can be run on any computer that has a browser with support for it (most major browsers support JavaScript). This is NOT the same as Java, as some might confuse it to be. JavaScript is a little bit similar to Ruby, in some ways, but its syntax is C-like.

hello.js :
var name= prompt ("Hello, what is your name?"); 

if (name == "Joe"){ 

  alert ("Great name!"); 

} else if (name == "Bob"){ 

  alert ("Horrible name!"); 

} else { 

  alert ("Hello, " + name + ", how are you?"); 

} 

// Also, you can write to the HTML document, if you'd like, for example: 

document.write ("Hello, this is <b>now</b> the <span style=\"color:red;\">HTML</span>."); 


PHP:
A server-side language, based on HTML, but with the ability to have embedded code.

hello.php:
<html> 

  <head> 

    <title> Hello! </title> 

  </head> 

  <body> 

    <h1> Hello! </h1> 

    <?php 

      // There is not a simple way to ask the user for their name, so we'll just use one. 

      // We could ask for their name, etc., but it would be more complex than just 

      // a simple example. 

      $name= "Tom"; 

      if ($name == "Joe"){ 

        echo "Great name!"; 

      } elseif ($name == "Bob"){ 

        echo "Horrible name!"; 

      } else { 

        echo "Hello, " . $name . ", how are you?"; 

      } 

      // In PHP, "Hello $name" is the same as "Hello " . $name 

      // That only works for double-quotes, however. 

    ?> 

  </body> 

</html> 


Perl:
Also a server-side language; like Ruby, doesn't require argument parentheses for function calls.

hello.pl:
print "Content-Type: text/html\r\n\r\n"; 


print "<html> <head> <title> Hello! </title> </head> <body> <h1> Hello! </h1> "; 

my $name= "Tom"; 

// I sort of forgot how to do 'if' statements in Perl, but I think they're similar to PHP and Ruby 'if' statements. 

print "Hello $name";     # Similar to PHP. 

print "</body> </html>"; 


C:
C is a general-purpose, computer programming language. It can also be used for programming other machines besides computers, and it's usually portable.

hello.c:
#include <stdio.h> 

#include <string.h> 


int main (int argc, char * argv []){ 

  char name1 [512];    // 'char' means "character" ; it's a [I]type[/I] 

  // 512 - 1 is the maximum length for the text we can use. 

  printf ("Hello, what is your name?\r\n"); 

  scanf ("%511[^\r\n]", name1); 

  if (!strcmp (name1, "Joe")){ 

    printf ("Great name!"); 

  } else if (!strcmp (name1, "Bob")){ 

    printf ("Horrible name!"); 

  } else { 

    printf ("Hello, %s, how are you?", name1); 

  } 

  return 0; 

} 


Assembly:
Assembly language is a processor-level language, where you get to give instructions to the processor of what, exactly, to do, and when. It does require a bit more housekeeping, but if you like thinking from the processor's perspective, you might find this a good language; assembly is a simple language. Whereas in other languages you have statements (for example, 'print "Hello World!\r\n"; '), in assembly, you have instructions.

For every instruction there is an optional label, a mnemonic with 0 to 3 operands - depending on the instruction's mnemonic - and an optional comment; or a combination of these three.

label: mnemonic operand1, operand2, operand3 ; comment

For example, the following code copies (or "moves") the value from the memory location at 0x8021 to the extended (32-bit) accumulator register (a register is a temporary storage compartment inside the processor):
mov eax, [0x8021] 

The above code is the same as this, except this also has a label:
some_label_name_01: mov eax, [0x8021] 
, etc.

Here's an example "Hello World!" program (hello_simple.asm):
main: 


push dword text01 

call printf 

add esp, 4 


ret 


section .data 

text01: 

db "Hello World!", 0 

Another thing, assembly is pretty flexible, and you get to decide on how you want the processor to accomplish a certain task.



#5
agnl666

agnl666

    Programmer

  • Members
  • PipPipPipPip
  • 173 posts
  • Programming Language:C, Java, C++
  • Learning:Python, Assembly
Welcome to CodeCall!

#6
zodiac

zodiac

    Newbie

  • Members
  • Pip
  • 6 posts
Well, I'm happy you got your cube out. I do know how to solve 4x4s but take like 3-4 minutes because I learnt a couple of days ago. What's your 3x3 record?

As for programming, I think I'd be quite happy to start with something general, something that can help me understand how things work. I still don't know what I want to do with it. From what you've written, I guess C could be a good option. What do you think? Do I need to know any basics before starting with a language? Where can I find a tutorial with the firsts steps?

Thanks!

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Welcome aboard! I can't solve Rubik's cubes, but I do know that, mathematically, they're just a permutation group.

There's tradeoffs for every choice of first language, so it really depends on where you'd like to go with it. I have a soft spot for C++, but realize that C or C++ will keep you away from the fun interfaces for a while. The perk: you'll learn a lot more about how code works.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#8
zodiac

zodiac

    Newbie

  • Members
  • Pip
  • 6 posts
I'm not in a rush to do fancy things. In deed, I'd prefer to have to work harder and longer but really have a deep understanding on the subject. How should I start with C++? Any suggestions?

About the rubik's cube, I recommend you get hold of one and learn the begginer's method, it's really fun - check out badmephisto.com, there's no better teacher than him.

Thanks!

#9
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Actually, it bemuses my wife and her parents that the Rubik's cube is about the only puzzle I do NOT like. For C++, get a solid beginner's book on it and go to town. You don't need to know C first.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#10
zodiac

zodiac

    Newbie

  • Members
  • Pip
  • 6 posts
Ok, I may order one through amazon, any particular book? "C++ Primer Plus" by Stephen Prata is the first one that appears on the list, is that one good?

#11
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US

zodiac said:

What's your 3x3 record?

The fastest record I can remember was a minute and twenty seconds.

* * *

zodiac said:

Ok, I may order one through amazon, any particular book? "C++ Primer Plus" by Stephen Prata is the first one that appears on the list, is that one good?

I don't have much experience with buying C++ books, so I can't really tell much about that.

The way I learned C/C++ is from online tutorials (cprogramming.com). I still don't know that much C++, I mean, it's possible to add strings using C++ plus operator? What? It's just not "low-level," in that way.

You can learn C++ if you want to, maybe it's just me; I just think the high-level languages should get to do things like adding strings with operators, dynamic string size, etc.

Here's what I mean by "adding strings with operators" (this is from a C++ program by Juan Quiroz):

Quote

...

string outFileName;

...

outFileName += ".pgm";

...

And it compiled correctly, which was a big surprise to me. :w00t:

In C, that would have had to be done more like this:
...

#include <string.h> 

...

char outFileName [512]; 

...

strcat (outFileName, ".pgm"); 

...

But yeah, whatever syntax you find more comfortable. :)

#12
zodiac

zodiac

    Newbie

  • Members
  • Pip
  • 6 posts
Ok, I'll start on-line and get a book when I'm able to.

I understood about 0% of that string thing xD

Well, it's time to start learning!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users