Simple programming

Had your computer crash on you, or a website shows wrong, or your printer went dead on you? Come on in...

Moderator: Crew

Post Reply
User avatar
Chillum
Legend
Posts: 756
Joined: Fri Feb 17, 2006 18:27
Location: Denmark

Simple programming

Post by Chillum »

Hello!

I know that there are some programming geeks (:)) inhere.. So:

I don't know a thing about programming, but I would like to have a few simple programming skills...
I'm thinking of making a little "converter".. Lets say fx a cm to meter converter.. As I said, I don't know a thing about it, but I wouldn't think that it's THAT hard to create such one.. :roll: I'm not talking about one of these online converters, but an "converter.exe" file, if you know what I mean? ;)

Hope to get some knowledge ;)
[u][b][color=indigo]:Givemebeer:....................It's a bird! It's a plane! No! It's.....................:Givemebeer:[/color][/b][/u]
[img]http://img506.imageshack.us/img506/3111/banner4gl.gif[/img]

Be sure to check [color=blue][b][url=http://www.lost.eu/336d9]this one[/url][/b][/color] out!
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS
Contact:

Post by Maz »

Oh joy.. Once again an young padawan is selling his soul to the dark arts of programming... :D

First you should select the programming language you wished to use. Here's some options like C or C++, pascal, C# (which I know nothing of), BASIC, FORTRAN, perl, ASSEMPLY or even JAVA or php. (or some dozens of others :D )

Some generic info:
C / C++ many uses. In fact, almost unlimited posssibilities, but since these are quite low level languages, building complex things may require some work. On the other hand, in right hands it makes these really effective tools. There's PLENTY of material available, since these are perhaps the best known languages. I would sggest you to start with them.

PASCAL & BASIC: outdated languages, used mainly for teaching the basic ideology of programming. (But due to some limitations, I think these are not good for even that anymore...)

FORTRAN: Old language, (although Fortran 95 is quite new improvement to the old 90 and 77 fortrans). Clumsy for most tasks, but still unbeatable what comes to number crunching. Still widely used amongst researchers (in mathematical sciences like physics).

perl: Quite powerfull & easy to use high level programminglanguage. I do not really know this language, but AFAK it is mostly used for text manipulation/linux scripts. (I can be terribly wrong with this)

ASSEMPLY: The lowest level programming, if you have keyboard with other keys but 1 and 0 :D Basically this is based writing of instructions straight for processor. Requires good knowledge about the way computer operates and also years of using to master this. Still the most efficient way, if you are clever enough. (Well nowadays many C / C++ compilers 'translate' C / C++ code to better machinecode than a human programmer is ever able to. But with understanding of assemply it's possible to breal any code written for computer. (in theory).

JAVA: Mostly used in the web publisihng, but can do indeoendent programs too. (like the hangman in old version of MazBot :D ) Not dependant the architecture of the machine, because there's 'java translator' running on computer (if installed), which 'translates' the code on the target computer. Slow (at least used to be) object oriented language.

php: Like JAVA done for web publishing. But if php interpreter is installed, the code can be ran from commandline too. Will be translated during running of the code. Includes lots of features from C / C++, but has also tons of it's own functions, mainly designed for web publishing.
User avatar
Chillum
Legend
Posts: 756
Joined: Fri Feb 17, 2006 18:27
Location: Denmark

Post by Chillum »

I had C/C++ in mind from the beginning.. :roll:

I pick that :p
[u][b][color=indigo]:Givemebeer:....................It's a bird! It's a plane! No! It's.....................:Givemebeer:[/color][/b][/u]
[img]http://img506.imageshack.us/img506/3111/banner4gl.gif[/img]

Be sure to check [color=blue][b][url=http://www.lost.eu/336d9]this one[/url][/b][/color] out!
User avatar
mistergreen77
Tycoon
Posts: 269
Joined: Fri Mar 31, 2006 2:09
Location: Brisbane

Post by mistergreen77 »

There is a fair bit of theory you should know first - but most people learn it later :D Programmers speak a language of their own (apart from programming languages) known between us as the lingo but otherwise referred to as jargon.

First thing you need is a compiler. Sound like jargon? A compiler is a program that reads in the source code for your program and compiles machine code understandable by the cpu. If you want to learn c/c++ and don't want to switch to linux (which comes with all these goodies) then download dev-c++ from bloodshed. Once you have this installed you are ready to write your first program.
[size=84][color=green]“Everything should be made as simple as possible, but not one bit simpler.”[/color] - Einstein

[color=green]“There is always some madness in love. But there is also always some reason in madness.”[/color] - Nietzsche[/size]

:twisted: [url=http://forum.connect-webdesign.dk/viewtopic.php?p=5411#5411]Society of Sinister Minds.[/url]
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS
Contact:

Post by Maz »

MrG is right. Theres no shortcuts to learn programming. Only way is the hard way: Get yourself a compiler (Dev C++ is excellent windows compiler + it's free :) ). Find some material (here's one place: http://www.imada.sdu.dk/~svalle/courses ... 0000000000 )

Read a few chapters to get some basic info, and start figuring out how it works. Try to write a program, and come back to here to ask if (actually when) you'll encounter problems/have questions :) It's not really possible to just start teaching C programming out of the blue, since that would require us to write a book :D It's much easier to answer questions (yes, even basic questions. There's no stupid questions :) ) you might have than to try to pour the C knowledge into ones head :D And learning through doing is much more efficient than just reading what people suggest you to do :)

I will give some basic info about how to start writing the code.
1. after getting dev C++ open your notepad and create empty file and save it as something.c (select filetype as all filetypes, and type the extension in name. Otherwise the clever Wirudows just adds the extension there is selected as default at the end of the name. (usually .txt resulting something.c.txt) )

Now doubleclick the file, and Dev C++ opens it.
(you can also open DEV c++, and create new project, but then you need to answer some questions which I do not remember anymore :D )

Then write the code in the file you created which is now opened. Save it, and find a button which says 'compile' from panel at the upperpart of the editor. (mm... I think it said compile when hovering over it with the mouse. click it. If all goes well, your program gets compiled & linked (translated into machinecode) otherwise you'll get some errors. (Typical errors are missing semicolons at the end of lines, check for that.) Usually there's line number telling on which line the error occurred, but in some cases, it might have occurred earlier than the number shows...

If you managed to compile the code, hit button saying 'run', or find the compiled .exe file, and use command prompt to launch it. If your program writes something on screen before exiting, you might not have time to see it before the program finishes and the window closes, if you used the 'run' button. If you ran it from commandprompt, window stays open. (tip, add function getchar(); in line before program ends. That waits for user to enter a character and press enter. That way you'll be able to see the output.)

I wish you good luck, patience & joy of success :)
Come back & ask some questions, so we know you really started the learning :D :D :D
User avatar
Zyx
Pretender to the throne
Posts: 1907
Joined: Wed Mar 29, 2006 20:48
Location: Helsinki
Contact:

Post by Zyx »

Chillum, if your intrests are learning programming by making small tools like "cm to meters converter", I'd advice you to learn a more high-level language than C(++) first. Something like Java, Python, Ruby or Perl. Er... maybe I should the perl out of that list, but anyway... except for Java, these languages require no compiling (faster trial-and-error -cycle!). You also get a lot of stuff free (so to say), unlike with C.

First thing you need is a good text editor. (No, notepad is not a good one.)

Python is a safe bet, so go www.python.org and start hacking. They have quite a lot of resources over there. Grab a good tutorial with excercises and you should be good to go.

But whatever you do, stay the f*** out of php. It will teach (in fact, force) you to do bad code.
Do you has what it takes to join the Homestarmy? The guts? The determination? The five bucks? Join today!
Post Reply