Posted by Edge Damodred on Fri Jan 16th at 9:08pm 2004
Edge Damodred
member
237 posts
54 snarkmarks
Registered: Apr 24th 2002
Location: I don't even know anymore

Occupation: student
Posted by Crono on Fri Jan 16th at 9:23pm 2004
*Note: Most C++ books, believe it or not, are WRONG! Especially with templates . . . ewwww
So, Edge does that mean that when I write a compiler (in about 4 months) people will inadvertently be bowing to me? and being my bitch?? Not that it will be up to par with commercial compilers or optimized in any way.
[EDIT-Reply to Edges 1st comment below]
The really funny thing is a true 'template' could never be made using the idea of templates.
[/EDIT-Reply to Edges 1st comment below]
[EDIT-Reply to Edges 2nd comment below]
Mwa hahahaha! . . . cool.
[/EDIT-Reply to Edges 2nd comment below] [addsig]
Posted by Edge Damodred on Fri Jan 16th at 9:27pm 2004
Templates are seductively evil...very seductively evil, like the STL...
And if your compiler gets the program to do what the person wanted, that person WILL be your bitch
.
Edge Damodred
member
237 posts
54 snarkmarks
Registered: Apr 24th 2002
Location: I don't even know anymore

Occupation: student
Posted by DesPlesda on Sat Jan 17th at 2:25am 2004
DesPlesda
member
204 posts
30 snarkmarks
Registered: Feb 14th 2002
Location: Tasmania, Australia

Occupation: Student
Posted by fraggard on Sat Jan 17th at 3:35am 2004
| ? posted by DesPlesda |
| Oztman, I wouldn't recommend learning C++ first. Learn C, as it's simpler (and in my opinion better) so that you understand the basics of imperative programming before you start on object-oriented coding. |
I second that. There's no real reason for a learner to be learning C++. Make sure you understand Procedure oriented programming before you shift to OO. And don't believe all the cooks out there who scream about C being outdated and C++ being "b3s+ 3v4r!!!" and all that. C++ is probably only good for very, very large applications which lose coherence with structured languages.
fraggard
member
1110 posts
201 snarkmarks
Registered: Jul 8th 2002
Location: Bangalore, India

Occupation: Student
Posted by Edge Damodred on Sat Jan 17th at 3:54am 2004
C is hardly outdated, all PS2 games are written in C, and still many game dev houses use it, Bioware for one. C++ does provide a slight overhead, but the development time and object hierarchy more than make up for it. It would certainly help to understand procedural programming before learning OOP, but is not entirely necessary, although the more you know the better.
Now lets end this language debate, as fragmented this site is between editors for various games, we'll be arguing over a whole bunch of languages before the time is done.
[addsig]Edge Damodred
member
237 posts
54 snarkmarks
Registered: Apr 24th 2002
Location: I don't even know anymore

Occupation: student
Posted by Monqui on Sat Jan 17th at 5:53am 2004
Right now I'm taking 2 programming classes- one uses Scheme, and one uses COBOL.
Wtf.
In the past, we've done stuff with Ada (which is a miserable language- learn some other Algol based langage if you're dead set on learning something like that), Java (which might have been interesting if we really got to delve into it, but for what we were using it for, it was absolutely useless), and Assembly (which is actually really good to know, so that wasn't a total waste).
But on topic- yes. Learn something non-OO based first. Since I'm sure at this point, you aren't going to use classes, its kind of useless to learn a language for which classes play a major part, when you could just as easily teach yourself C (which provides a great foundation for scores of other languages.. [addsig]
Monqui
member
743 posts
94 snarkmarks
Registered: Sep 20th 2002
Location: Iowa, USA

Occupation: Poor College Student
Posted by DesPlesda on Sat Jan 17th at 6:33am 2004
DesPlesda
member
204 posts
30 snarkmarks
Registered: Feb 14th 2002
Location: Tasmania, Australia

Occupation: Student
Posted by Edge Damodred on Sat Jan 17th at 7:01am 2004
The only problem with assembly is that it's machine specific, so if you list Assembly as a language you know, you had better specify for which hardware.
But yes, you can really delve deep into something know the hardware's assembly. One of my instructors wrote a hell of a lot better blitter for a mobile device over the one that was provided by the dev kit. He basically used it to find out where the hell the video memory started, a long and tedious process that payed off in spades.
Now go learn each machine's machine code ![]()
Edge Damodred
member
237 posts
54 snarkmarks
Registered: Apr 24th 2002
Location: I don't even know anymore

Occupation: student
Posted by Crono on Sat Jan 17th at 7:14am 2004
Secondly. I would actually suggest for a very first language, if you have no experience, Java. It has all the power C++ has and it is higher level. Then you should work your way down to C++ (which is pratically the same as C, if you know C++ you know C, you just need to change the way you do a few things). then Get down to Assembly. I found that it is much easier to learn assembly (and faster) if you have a language to base it on. This has been my experience, and Most universities experiences.
C++ is actually perfect for procedure programming, it just depends on what book you have!
I've said it before, I'll say it again:
C++ Primer Plus By Stephen Prata covers the entire language (ISBN# 1-57169-162-6) You can probably find a used copy of the 3rd edition or earlier at somewhere like Powels, if you know what that is. It would probably be like 15 bucks.
Another must have programming book is
The C Programming Language by Brian Kernighan and Dennis Ritchie (ISBN#0-13-110362-8)
That last book especially is a major milestone in standard programming syntax.
If you're looking for a Data Structures Book, you're pretty much on your own.
Simply because most people (Authors) delute what should and shouldn't be done.
If you're looking for some Java help I recommend this book:
Thinking in Java By Bruce Eckel
You can download it from his site here
Also, just for some background knowledge, Java is ONLY object oriented (if you didn't know). It's a nice language, but it has some slow runtimes (garbage collection).
Some nice aspects though are you don't have to clean up your dynamic memory, it is handled by the garbage collector.
The language is very nice and if Sun could get it to run faster it would easily replace C++ as the standard for run-time application development. [addsig]
Posted by fraggard on Sat Jan 17th at 8:04am 2004
| ? posted by Crono |
| C++ is actually perfect for procedure programming, it just depends on what book you have! |
Er, doesn't that beat the whole purpose of C++? I'm not disputing the validity of what you said. Just the purpose
. What use is C++ when C generates more efficient code in the Procedure oriented way?
And as far as books go, I've used "Herbert Schildt: C++ the complete reference" for C++ and found it very good for reference (duh!) assuming you know some programming... Also I suppose you could use "Langsam, Augenstein and Tanenbaum" for data structures (in C and C++). Slightly complicated but overall very solid.
/useless info
fraggard
member
1110 posts
201 snarkmarks
Registered: Jul 8th 2002
Location: Bangalore, India

Occupation: Student
Posted by OtZman on Sat Jan 17th at 1:01pm 2004
The reason to why I'm trying to learn C++ instead of Java or C or something is that in half a year I will do a C++ beginner course at school and I plan to finish it now.
| ? posted by Edge Damodred |
|
There's nothing wrong with the code in itself, it's just that console apps shut down as soon as you're finished. You can write a batch file with the following lines *****.exe (name of the executable) pause rename the text file to .bat and run it from there. Some compilers will do this for you when you run in debug mode, but not all. That should work for you though. You could also put some kind of input statement at the end. cout<<"Input q to quit." char q; cin>>q; but that just looks bad, so go with the .bat method. |
The batch file method worked, but than some other lines also were printed on the screen like "C:\Dev-cpp\[code]\>pause". The other method with the cin statement didn't work...
#include <iostream>
using namespace std;
int main()
{
cout << "My first program ";
cout<<"Input q to quit."
char q;
cin>>q;
return 0;
}
The book I'm reading from recommends Microsoft Visual C++ 6.0... I don't know if the "My first program" text would "stay" on screen if I used this program to compile...
[addsig]OtZman
member
1890 posts
199 snarkmarks
Registered: Jul 12th 2003
Location: Sweden

Occupation: Student
Posted by scary_jeff on Sat Jan 17th at 1:30pm 2004
Posted by OtZman on Sat Jan 17th at 2:16pm 2004
OtZman
member
1890 posts
199 snarkmarks
Registered: Jul 12th 2003
Location: Sweden

Occupation: Student
Posted by OtZman on Sat Jan 17th at 2:46pm 2004
OtZman
member
1890 posts
199 snarkmarks
Registered: Jul 12th 2003
Location: Sweden

Occupation: Student
Posted by fraggard on Sat Jan 17th at 4:21pm 2004
You can use cout for ASCII only, I think. So I'm not sure it can print accented characters. Try an ASCII chart or print one out.
for(int i=0; i<255; i++)
{ cout<<"\n"<<(char) i ;
}
Should do it for you ![]()
Edit: http://www.jimprice.com/ascii-0-127.gif
fraggard
member
1110 posts
201 snarkmarks
Registered: Jul 8th 2002
Location: Bangalore, India

Occupation: Student
Posted by OtZman on Sat Jan 17th at 5:55pm 2004
Do you mean like this?
// Ett "f?rsta" exempel
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
cout << "Mitt f?rsta program";
getch();
for(int i=0; i<255; i++)
{ cout<<"\n"<<(char) i ;
}
return 0;
}
It didn't work![]()
OtZman
member
1890 posts
199 snarkmarks
Registered: Jul 12th 2003
Location: Sweden

Occupation: Student
Posted by Monqui on Sat Jan 17th at 6:04pm 2004
for(int i=0; i<255; i++)
{ cout<<"\n"<<(char) i ;
}
Dunno if you're familiar with this construct- its called a for loop. Basically, it initializes an integer variable (in this case, i) to be = to 0. Then, the body of the loop executes (the 'cout <<"\n"<<(char) 1;' part) for i = 0. When that is finished, it evaluates the i<255 clause, and if it is true, then it increments i, and executes the loop body again.
It continues this pattern of incrementing/executing/checking unit the i<255 part returns false (or, when i is greater than or = to 255).
The (char) part is what is known as Casting- basically, you are telling it to output i in terms of a character, instead of an integer (without it, all this program would do would print the numbers 1 to 255 on the screen).
So what tha code is supposed to do is output all 255 characters in the ASCII dataset onto the screen.
Oh, and "\n" is a character (technically only ONE character) that prints out a new line.
But, I think you're running into the same case as before- the program is outputing information to the screen, and then closing before you get a chance to see it. Add another getch() afterwords.
You should see the last few characters in the ASCII dataset.
If you want to fit them all on the screen, replace the "\n" part of the loop body with a "\t" (it moves the cursor to the next tab break). [addsig]
Monqui
member
743 posts
94 snarkmarks
Registered: Sep 20th 2002
Location: Iowa, USA

Occupation: Poor College Student
Posted by OtZman on Sat Jan 17th at 6:54pm 2004
I've never heard of a loop before. I'm totally new to programming, but I thing I start to understand what a loop is, but I don't get how to make letters like ?, ?, ? to appear on my screen 
OtZman
member
1890 posts
199 snarkmarks
Registered: Jul 12th 2003
Location: Sweden

Occupation: Student
Posted by Monqui on Sat Jan 17th at 7:21pm 2004
Monqui
member
743 posts
94 snarkmarks
Registered: Sep 20th 2002
Location: Iowa, USA

Occupation: Poor College Student
Snarkpit v6.1.0 created this page in 0.0279 seconds.

