PlaneShift
Fan Area => The Hydlaa Plaza => Topic started by: Sifright on December 03, 2003, 08:15:22 pm
-
Well i want to learn too code but i cant go to university yet (im 16) so ya know i am wondering how to do this i have a feeling learning C++ cant just be done off a website toturial just wondering if there are any books people can recomend for me to buy or indeed if there are any websites that can teach some basics ive tried modeling but i got fed up after 4 months when my models still came out looking like dog **** :p
plz dont bother posting if you have nothing relavent to say
(IE. I dont know good luck )
-
There are tons of good books out there that will teach you to program in C++. I don\'t know off-hand which books are the best, but if you really want to learn buy books and just keep practice by yourself. Also some colleges will offer summer classes for high school students. You\'d have to pay for them but if you are really serious about you should check if any near you offer them. I taught myself Java from just reading books and working on it by myself before taking C++, and they are very similar.
-
Hmm well i am seroius about learning to code but dedicated to it well i dunno about that lol the reason i want to make sure tehre are no websites that contain those books is cause those books cost like ?30!! tis alot for me :p well if i have to resort to a book i will
Edit: Wooohoo i have found a website to teach me the basics
// Program to add 3 numbers;
// File: Ch2Prg1.cpp
#include
void main()
// Purpose: To add 3 numbers and output the sum
// Receives: NONE
// Returns: NONE
{
int value1;
int value2;
int value3;
int sum;
cout << \"Please enter your first integer value \";
cin >> value1;
cout << \"Please enter your second integer value \";
cin >> value2;
cout << \"Please enter your third integer value \";
cin >> value3;
sum = value1 + value2 + value3;
cout << \"The sum is: \" << sum << endl;
}
if any 1 wants me to explain that i can :D ive learnt how to get a program to accept variables integers
i am intrigued its alot like html but much more complex :)
-
Have you already used any programming language before ? (no, I don\'t mean HTML) If not then pick some easier language first, Python or Java maybe. Buy some book for beginners. Here are some online books (not for beginners) http://mindview.net/Books
-
Void Main() = This is the main part of the script or code. It\'s the base, if you will... you can have procedures within the Main code, but there\'s nothing outside Main itself (except global declarations and include files).
Text prefixed with // are comments. These are ignored by the program and appear purely to describe things to the programmer.
{ (an open bracket) tells the program that a new procedure is starting. All code that follows a { and ends with a } is one procedure and is generally not affected by other procedures.
\"int\" means Integer. This forces the program to believe that the value is numeric only.
\"sum\" is a mathematical instruction. It explains itself, really. ;)
\"cout\" is a text output. It\'s what the program is saying to you. Similarly, \"cin\" is an input. In your example code, your text input (which can only be a number, according to the \"int\" ) is being designated as \"Value1\" so that the program can easily distinguish between it and other items.
sum = value1 + value2 + value3; This line is an instruction to the program. It is telling it to add up the three values based on what you input for each of them.
The last line of code is the final instruction given to the program. It tells the program: \"Say \'The sum is\', then say the value of the \'sum\' line, and that\'s all.\"
Finally, this procedure is closed with a }.
My terminology might not be perfect here, but I hope it helps a little. :)
-
i havent used program langs before but html is some what simular :P in that are several features that are the same athough i admit html is no where near near as complex. im getting micro soft visual studio for my compiler full version all 16 cds of it :o im fairly seroius in learning this but i will prolly adavace fairly slowly haveing school work and such it must come first
Edit : mogura do you by any chance know how to code or did you work that out?? :O
-
I\'ve learnt VB in college, this isn\'t very different. :) Of course, half of it is logic anyway.
-
1. I\'d definetly start with sth else, like scripting languages or the visua studio-like ones(you have real grafic output, yay).
2. Moogie, I think your post was irrelevant.if any 1 wants me to explain that i can
That\'s the way I see it.
-
bah bugger a scripting lang no offense but i would rather learn somthing i can put to real practical use Ie coding a game or somthing later on when i get profecient with it and as for moguras post its good it helped me a little after all i learnt how to do that and what it does but it does help clarfiy somthing firstly the { } i didnt under stand what those where for but now i do you could write a program to run multipule precedures and each procedsure is independant am i right??
-
Apologies- I\'m tired, thought he said \"any 1 want to explain that to me\", hehe. :)
Sifright: These languages are what all programs are made of. PS itself uses alot of C++.
I\'m not sure I can really explain the { } symbols properly, so I think I should leave that to someone else. :) Don\'t want to confuse you.
-
yes. But you can do games with scriptin langs...even HTML and just a taste of javascript can throw up sth good.
{} in many langs these dont exist, but you have if...end if or if...fi words to end loops and such.
I started seriously with Visual Studio, visual basic.
edit: nice coincidence. b) you don\'t have to apologize.
-
Mogura i knew that allready :) most things ae coded with c++ at least on Pc\'s not sure about macintosh etc but any who if Plane shift is open source is there any way i cold have a look at the source code??
i tought my self html by looking at the source for each page of a website and experimenting just wondering if its possible to do the same :P
-
Originally posted by Sifright
int value1;
int value2;
int value3;
int sum;
just a small note really, you don\'t have to declare every variable by starting a new int, you can just as easily use a comma (ex, int v1, v2, v3, sum; )
-
The full source code is available from Sourceforge. Or you can download the most up-to-date version of the game from CVS.
*doesn\'t have direct links right now*
-
i took a beginners C++ in highschool and now im in college level java, it gets funner the more we dive into things. i would like to learn html though so i could totally design my own websites!
If anyone could help me out that would be incredible!
-
HTML is not a programming language, it\'s language for defining contents of web pages. There are no data structures, no algorithms, just text, images and controls layered in some structure.
C++ is not only much more complex than HTML, it is completely different kind of thing. You can\'t suddenly start programming games in C++ when everything you know is HTML (i.e. you don\'t know any programming language). There is a LONG WAY to go before you can write serious computer games. Or any computer games. Good luck.
> i tought my self html by looking at the source for each page
> of a website and experimenting just wondering if its
> possible to do the same
Believe me, it is not.
http://cvs.sourceforge.net/viewcvs.py/planeshift/planeshift/src/
Btw the system for viewing the sources is written in .... Python (\"scripting lang\")
-
Originally posted by Sifright
i havent used program langs before but html is some what simular :P in that are several features that are the same athough i admit html is no where near near as complex.
No! Please no! HTML is a formatting language, not a programming language!
And if the price is a problem for you, you should borrow books from your school or town\'s library. It\'s a very good way to give a try to several languages and pick up the one fitting you the best at the moment.
-
Here is something similar but that\'s not C++ ;)
http://cvs.sourceforge.net/viewcvs.py/planeshift/planeshift/data/inventory.xml?rev=1.7&view=auto
-
Originally posted by Mogura
I\'ve learnt VB in college, this isn\'t very different. :) Of course, half of it is logic anyway.
It\'s more like this:
90% - Programming theory (Logic, as Moogie would put it): knowing what a program is, how computers process instructions, understanding varibles, memory, loops, conditional statements, functions/subroutines (these are the same, but VB treats them differently :P), templates, and if you\'re programming with an OOP (like C++): encapsulation, inheritance, and polymorphism.
10% - Grammar: While most every programming language will have loops, variables, etc., they all use a different sequence of characters that inform the compiler as to what it is. Also includes things like the use of curly braces and semicolons.
The nice part is, once you learn programming theory, you can pick up on just about any other programming lanuage very quickly, because all you need to learn is what words and symbols are used to perform the various programming tasks.
Originally posted by Keldorn
just a small note really, you don\'t have to declare every variable by starting a new int, you can just as easily use a comma (ex, int v1, v2, v3, sum; )
This is really a matter of personal preference. My C++ instructors were all very strict about never using the comma separation method, so that\'s just the way I was brought up. It\'s just the way that i\'m comfortable with.
And finally, I am SHOCKED that a) no one caught the mistake in the code posted by Sifright, and b) that sample code was so malicious in teaching people bad habits.
NEVER EVER EVER EVER EVER EVER have \"main()\" return void!!! \"main()\" must ALWAYS return an int!! It has been this way since the beginning of C programming, and it should always be used, no matter how simple of a program you making. Declare \"int main()\" (or for those of us rigid types, \"int main(void)\") or if you need command line parsing, go ahead and use \"int main (int argc, char *argv[])\" but NEVER use \"void main()\"!! That\'s all you need to do, besides returning a value. If you\'re really lazy, you can type \"return 0;\" at the end of \"main()\" but you really should have \"#include \" up with your includes, and \"return EXIT_SUCCESS;\" for reasons of compatibility and portability.
I just can\'t believe the things people are posting on webisites nowadays :(
-
Originally posted by Xandria
NEVER EVER EVER EVER EVER EVER have \"main()\" return void!!! \"main()\" must ALWAYS return an int!! It has been this way since the beginning of C programming, and it should always be used, no matter how simple of a program you making. Declare \"int main()\" (or for those of us rigid types, \"int main(void)\") or if you need command line parsing, go ahead and use \"int main (int argc, char *argv[])\" but NEVER use \"void main()\"!! That\'s all you need to do, besides returning a value. If you\'re really lazy, you can type \"return 0;\" at the end of \"main()\" but you really should have \"#include \" up with your includes, and \"return EXIT_SUCCESS;\" for reasons of compatibility and portability.
I just can\'t believe the things people are posting on webisites nowadays :(
Funny thing is, I took a C++ programing class last year and we almost always used void main... lol
The only time this changed is when we got later in the year when our programs became more complicated. So I guess it isnt just the internet teaching bad habits :D
-
Lots of sites on the internet have bad javascript coding. I can tell because they work fine in IE, but not in any other browsers. :D
Although not useful for programming applications, javascript can really enhance any sties you make, and introduces you to many fundementals of programming(structure, the weird {} [] // ; : \' \" symbols, etc.)
-
Yep, nope. Microsoft made their version of javascript, jscript...which has more options but is I(n)Et(h)ic.;) AFAIK
-
(Cough cough i know html is not a programing languegue) but it does have some simularitys in the way it is structured any how i am going to get a book on saterday for programing its about 2000 pages long : / its suposed to teach from the very basics all the way trough to the hard stuff :p (this will take a long time to work trough)
-
Yup. When you\'ve learned some of the basics, leave the book alone(boring examples) and try sth interesting yourself...then only return to the book when you don\'t know sth or want to get to know the next level.
-
Originally posted by Kramy
Lots of sites on the internet have bad javascript coding. I can tell because they work fine in IE, but not in any other browsers. :D
As pointed out by lynx_lupo, Microsoft made his own version of Javascript, called Jscript, adding non-standard features of their own (please note that I don\'t judge their usefulness). Besides, there are different versions of Javascript that were released.
Judging the quality of anything (html/css/javascript/whatever) with IE is totally pointless, IE doesn\'t respect the standards of the web, and it\'s not because 95% of people use it that it\'s a good tool.
Originally posted by Keldorn
just a small note really, you don\'t have to declare every variable by starting a new int, you can just as easily use a comma (ex, int v1, v2, v3, sum; )
That can be confusing when declaring pointers, many people will tell you to declare pointers like that:
int* myPointer;
But if you declare two pointers on the same line, you have to specify * for everyone of them:
int* myPointer1, *myPointer2;
Of course the position of the space (leading or trailing) is pure convention, the compiler doesn\'t care at all. But somehow it clarifies the code, espcially if you have to initialize your variables at the same time:
int *myPointer1 = new int(3), *myPointer2 = new int(-7);
It\'s easier to read like that:
int* myPointer1 = new int(3);
int* myPointer2 = new int(-7);
Anyway, the compiled code will be exactly the same. Sifright don\'t be scared by all this talking, you\'ll see that programming also has a small aspect which is about writing conventions (how to indent, where to put or not put spaces, etc...), it\'s harmless :)
-
use void main() if you want. it is an alternate standard. The C lib will return 0 to the OS automatically if you make it void, so just returning 0 yourself is pointless.
-
i was wondering what the voidmain actuly does if some could explain for me plz :P
-
it\'s part of the return thing.
if u wanted the sub to return nothing(like in main)it\'s void
if u wanted the sub to return integers it\'s int
if u wanted the sub to return boolean it\'s boolean
...
See?
-
\"The main() function returns int.... If you void main() and you\'re writing code for a nuclear reactor or a military aircraft, you\'re probably feeling a little unsettled right now, and I don\'t blame you.... To be portable, you must return int from main and you must take either no arguments or the two specified by the standard\"
~ Richard Heathfield, C Unleashed
Those of you who programmers who haven\'t read through these, I\'d highly recommend it:
stl.caltech.edu - The Quotation Collection (http://stl.caltech.edu/quotes.shtml)
Real Programmers Don\'t Use Pascal (http://www.pbm.com/~lindahl/real.programmers.html)
The story of Mel (http://www.pbm.com/~lindahl/mel.html)