C++ compiler

C++ compiler

Re: C++ compiler Posted by OtZman on Thu Jan 15th 2004 at 4:35pm
OtZman
1890 posts
Posted 2004-01-15 4:35pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
Where can I find a good, free C++ code compiler?
Re: C++ compiler Posted by matt on Thu Jan 15th 2004 at 5:12pm
matt
1100 posts
Posted 2004-01-15 5:12pm
matt
member
1100 posts 246 snarkmarks Registered: Jun 26th 2002 Occupation: Student! Location: Edinburgh
Re: C++ compiler Posted by Forceflow on Thu Jan 15th 2004 at 5:41pm
Forceflow
2420 posts
Posted 2004-01-15 5:41pm
2420 posts 451 snarkmarks Registered: Nov 6th 2003 Occupation: Engineering Student (CS) Location: Belgium
Can't help it matt, but its pick.

Sorry. :smile:
Re: C++ compiler Posted by matt on Thu Jan 15th 2004 at 6:03pm
matt
1100 posts
Posted 2004-01-15 6:03pm
matt
member
1100 posts 246 snarkmarks Registered: Jun 26th 2002 Occupation: Student! Location: Edinburgh
Forceflow said:
Can't help it matt, but its pick.

Sorry. :smile:
Grrrrrr

:smile:
Re: C++ compiler Posted by Gwil on Thu Jan 15th 2004 at 6:31pm
Gwil
2864 posts
Posted 2004-01-15 6:31pm
Gwil
super admin
2864 posts 315 snarkmarks Registered: Oct 13th 2001 Occupation: Student Location: Derbyshire, UK
If you can get hold of Visual Studio from "a friend" for instance, try and get it :smile:

Microsoft tool, and bizarrely enough I rate it highly :smile: good piece of software!
Re: C++ compiler Posted by matt on Thu Jan 15th 2004 at 6:55pm
matt
1100 posts
Posted 2004-01-15 6:55pm
matt
member
1100 posts 246 snarkmarks Registered: Jun 26th 2002 Occupation: Student! Location: Edinburgh
Funnily enough, I have a copy of that. And yes, I cannot tell you how much free software I've got of friends and family. I could make a list. Really.
Re: C++ compiler Posted by Edge Damodred on Thu Jan 15th 2004 at 10:30pm
Edge Damodred
237 posts
Posted 2004-01-15 10:30pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
I'd get the Borland one and get Context, a word pad program designed for writing code/scripts, and set it up to use the compiler. Unfortunately, it doesn't come with a Debugger...at least I think it doesn't. Get one with a Debugger if you can, because they will help you tremendously in fixing s**t that looks right but is wrong.
Re: C++ compiler Posted by Crono on Thu Jan 15th 2004 at 10:43pm
Crono
6628 posts
Posted 2004-01-15 10:43pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
GNU has the top compilers for free, handsdown.

Most universities use GNU (gcc for C and g++ for C++)

Unfortunatly, you're probably using windows. So this exact version wont work, however, there is a package made by several groups called Mingw, a win32 version is included in this.

Go here to read how exact to get it and how to make it work:
mingw

Go here to download it:
Download

I hope all that helps. by the way, Gwil, he said free . . . . lol.

*note: check out gnu.org it has the gnu public license on it, which basically states its always free . . . and gnu isn't unix.
Re: C++ compiler Posted by DesPlesda on Fri Jan 16th 2004 at 2:01pm
DesPlesda
204 posts
Posted 2004-01-16 2:01pm
204 posts 30 snarkmarks Registered: Feb 14th 2002 Occupation: Student Location: Tasmania, Australia
The best C/C++ compiler and IDE (integrated development environment) that I've seen so far is Bloodshed Software's Dev-C++. It includes the GNU compiler kit (that is, the compiler GCC and the debugger GDB) along with a very easy to use graphical interface for programming. It also includes syntax highlighting, and (I found this particularly nice) a setting that causes the syntax highlighter to mimic Microsoft's Visual Studio. It's free under the GNU GPL.
Re: C++ compiler Posted by OtZman on Fri Jan 16th 2004 at 5:45pm
OtZman
1890 posts
Posted 2004-01-16 5:45pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
Now I've downloaded Dev-C++ and it seems to work fine and I've compiled my first program ever!!! :biggrin: The only problem is that when I try to run the program it is closed after 1/2 seconds or less... :cry:

This is the code I'm using:

#include <iostream>
using namespace std;

int main()
{
cout << "My first program ";
return 0;
}

Anyone with any ideas? What can be wrong? :confused:
Re: C++ compiler Posted by matt on Fri Jan 16th 2004 at 5:49pm
matt
1100 posts
Posted 2004-01-16 5:49pm
matt
member
1100 posts 246 snarkmarks Registered: Jun 26th 2002 Occupation: Student! Location: Edinburgh
Don't use C++ but I bet someone at this site does.
Re: C++ compiler Posted by OtZman on Fri Jan 16th 2004 at 5:51pm
OtZman
1890 posts
Posted 2004-01-16 5:51pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
Yes I hope so...
Re: C++ compiler Posted by Monqui on Fri Jan 16th 2004 at 6:15pm
Monqui
743 posts
Posted 2004-01-16 6:15pm
Monqui
member
743 posts 94 snarkmarks Registered: Sep 20th 2002 Occupation: Poor College Student Location: Iowa, USA
Probably because this is what is happening:

A window pops up that your prog is run in,
It prints out the "My first program " bit
Then the window closes because the program successfully finished

It probably is running just like it should, it's just going too fast for you to realize. Add in a cin >> or a getkey or something (its been a while since I've touched C++, so the commands might be different).
Re: C++ compiler Posted by Edge Damodred on Fri Jan 16th 2004 at 6:16pm
Edge Damodred
237 posts
Posted 2004-01-16 6:16pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
OtZman said:
Now I've downloaded Dev-C++ and it seems to work fine and I've compiled my first program ever!!! :biggrin: The only problem is that when I try to run the program it is closed after 1/2 seconds or less... :cry:

This is the code I'm using:

#include <iostream>
using namespace std;

int main()
{
cout << "My first program ";
return 0;
}

Anyone with any ideas? What can be wrong? :confused:
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.
Re: C++ compiler Posted by Crono on Fri Jan 16th 2004 at 8:14pm
Crono
6628 posts
Posted 2004-01-16 8:14pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
You could follow up your statement with '\\nPress Enter to Continue' with in the quotes of your cout statement

Then, sort of how Edge stated, create a cin>>; statement. I believe you don't have to have a variable saving the statement, because you just want the program haulted, in otherwords why would you save something you wouldn't use?

One more thing, is there any particular reason why you think you need a namespace for this program? lol
Re: C++ compiler Posted by asterix_vader on Fri Jan 16th 2004 at 8:24pm
asterix_vader
494 posts
Posted 2004-01-16 8:24pm
494 posts 49 snarkmarks Registered: Aug 29th 2003 Occupation: Trying to find one Location: Peru
Hey, someone who know how to use the compiler?
Re: C++ compiler Posted by Crono on Fri Jan 16th 2004 at 8:31pm
Crono
6628 posts
Posted 2004-01-16 8:31pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
Do you mean, is there someone who knows how to use a compiler? If so, yes, I do. . . Amongst many many people.
Re: C++ compiler Posted by Edge Damodred on Fri Jan 16th 2004 at 8:55pm
Edge Damodred
237 posts
Posted 2004-01-16 8:55pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
Crono said:
One more thing, is there in particular reason why you think you need a namespace for this program? lol
Because that's what everyone who does "Hello World" does...besides it can get annoying having to go back and grab specific components out of an object when you realized you just needed. Now when you release to the public...yeah, you'd better be getting only the things you need :wink:
Re: C++ compiler Posted by Crono on Fri Jan 16th 2004 at 8:59pm
Crono
6628 posts
Posted 2004-01-16 8:59pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
But the whole point is, you wouldn't need the namespace unless you were using tight, closed classes.

Why even bother putting it in there unless you're doing something like a hierarchy where it can actually make a difference?
Re: C++ compiler Posted by Monqui on Fri Jan 16th 2004 at 9:07pm
Monqui
743 posts
Posted 2004-01-16 9:07pm
Monqui
member
743 posts 94 snarkmarks Registered: Sep 20th 2002 Occupation: Poor College Student Location: Iowa, USA
Because this is his first program, and it was probably mentioned in whatever manual he got the idea from?

What does it matter in this case?
Re: C++ compiler Posted by Edge Damodred on Fri Jan 16th 2004 at 9:08pm
Edge Damodred
237 posts
Posted 2004-01-16 9:08pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
because if you don't the compiler's gonna bitch that it still doesn't know what "cout" is. Bow to the master that is the compiler, it is your master and you are its bitch.
Re: C++ compiler Posted by Crono on Fri Jan 16th 2004 at 9:23pm
Crono
6628 posts
Posted 2004-01-16 9:23pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
You include the iostream library so that the compiler can use the overloaded commands cout and cin. You don't need namespace. Especially with the GNU compiler, which he is using. I suggest you shop for some different books, because if it is the case that the book is telling you to use namespace when you're just outputting a line . . . then what else is it wrong about? This is how you can tell, does the author justify the use of namespace there? If he does. Look online in many areas to see what namespace is used for and que it up to the authors explination.

*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]
Re: C++ compiler Posted by Edge Damodred on Fri Jan 16th 2004 at 9:27pm
Edge Damodred
237 posts
Posted 2004-01-16 9:27pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
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 :biggrin: .
Re: C++ compiler Posted by DesPlesda on Sat Jan 17th 2004 at 2:25am
DesPlesda
204 posts
Posted 2004-01-17 2:25am
204 posts 30 snarkmarks Registered: Feb 14th 2002 Occupation: Student Location: Tasmania, Australia
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.
Re: C++ compiler Posted by fraggard on Sat Jan 17th 2004 at 3:35am
fraggard
1110 posts
Posted 2004-01-17 3:35am
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
DesPlesda said:
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.
Re: C++ compiler Posted by Edge Damodred on Sat Jan 17th 2004 at 3:54am
Edge Damodred
237 posts
Posted 2004-01-17 3:54am
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
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.
Re: C++ compiler Posted by Monqui on Sat Jan 17th 2004 at 5:53am
Monqui
743 posts
Posted 2004-01-17 5:53am
Monqui
member
743 posts 94 snarkmarks Registered: Sep 20th 2002 Occupation: Poor College Student Location: Iowa, USA
I wish I could learn normal languages like C up here at school (as in, take a class (not geared for CIS or MIS majors) that actually went in-depth with it.)

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..
Re: C++ compiler Posted by DesPlesda on Sat Jan 17th 2004 at 6:33am
DesPlesda
204 posts
Posted 2004-01-17 6:33am
204 posts 30 snarkmarks Registered: Feb 14th 2002 Occupation: Student Location: Tasmania, Australia
Assembly is a really good language to learn as your first language, because it gets you understanding the underlying principles of the computar machene. I recommend Assembly Language Step-By-Step by Jeff Duntemann (ISBN 0-471-37523-3). It's designed for non-programmers, and teaches all the basics of assembly. I love it.
Re: C++ compiler Posted by Edge Damodred on Sat Jan 17th 2004 at 7:01am
Edge Damodred
237 posts
Posted 2004-01-17 7:01am
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
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 :biggrin:
Re: C++ compiler Posted by Crono on Sat Jan 17th 2004 at 7:14am
Crono
6628 posts
Posted 2004-01-17 7:14am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
If you wanted to go about learning C first, why didn't you just write in C++ and not really try object orientation. Also, just because you're using a class doesn't mean you're doing object orientation.

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.
Re: C++ compiler Posted by fraggard on Sat Jan 17th 2004 at 8:04am
fraggard
1110 posts
Posted 2004-01-17 8:04am
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
Crono said:
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 :razz: . 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
Re: C++ compiler Posted by OtZman on Sat Jan 17th 2004 at 1:01pm
OtZman
1890 posts
Posted 2004-01-17 1:01pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
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.
Edge Damodred said:
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...
Re: C++ compiler Posted by scary_jeff on Sat Jan 17th 2004 at 1:30pm
scary_jeff
1614 posts
Posted 2004-01-17 1:30pm
1614 posts 191 snarkmarks Registered: Aug 22nd 2001
include conio.h and use getch(); at the end of the program. This will cause the program to stop at this point and exit after you press any key. I say don't bother with namespace for simple things like this because you really don't need it.
Re: C++ compiler Posted by OtZman on Sat Jan 17th 2004 at 2:16pm
OtZman
1890 posts
Posted 2004-01-17 2:16pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
Well that seems to work fine... thx a lot scary_jeff! :biggrin:
Re: C++ compiler Posted by OtZman on Sat Jan 17th 2004 at 2:46pm
OtZman
1890 posts
Posted 2004-01-17 2:46pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
My program won't print letters like ? ? ? ? ... is there anything I can do about it?
Re: C++ compiler Posted by fraggard on Sat Jan 17th 2004 at 4:21pm
fraggard
1110 posts
Posted 2004-01-17 4:21pm
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
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 :smile:

Edit: http://www.jimprice.com/ascii-0-127.gif
Re: C++ compiler Posted by OtZman on Sat Jan 17th 2004 at 5:55pm
OtZman
1890 posts
Posted 2004-01-17 5:55pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
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 :cry:
Re: C++ compiler Posted by Monqui on Sat Jan 17th 2004 at 6:04pm
Monqui
743 posts
Posted 2004-01-17 6:04pm
Monqui
member
743 posts 94 snarkmarks Registered: Sep 20th 2002 Occupation: Poor College Student Location: Iowa, USA
Kinda yes, kinda no. First off- lemme explain this code:

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).
Re: C++ compiler Posted by OtZman on Sat Jan 17th 2004 at 6:54pm
OtZman
1890 posts
Posted 2004-01-17 6:54pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
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 :confused:
Re: C++ compiler Posted by Monqui on Sat Jan 17th 2004 at 7:21pm
Monqui
743 posts
Posted 2004-01-17 7:21pm
Monqui
member
743 posts 94 snarkmarks Registered: Sep 20th 2002 Occupation: Poor College Student Location: Iowa, USA
What you would have to do is use some other character set than ASCII. How you would go about using this, I don't know. Never really had a reason to do it. Sorry bud.
Re: C++ compiler Posted by Edge Damodred on Sat Jan 17th 2004 at 8:08pm
Edge Damodred
237 posts
Posted 2004-01-17 8:08pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
OtZman said:
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 :confused:
How to make those appear on purpose or on accident.

On accident it's just random chode(garbage) that was picked up in the memory that that was grabbed and it interprets it as characters.

but yeah, to see if it's in ASCII, use the for loop and modify the output statement slightly to see the corresponding numbers

cout<<"\\n"<<(char) i <<'\\t'<< i;

Oh, for single characters and escape sequences(anything that starts with \\), you can just use a single quote.

To print out the character '', you'll have to do '\\' to get the compiler to shut up about illegal escape sequences and stuff, even when you send in directory strings as well.

Oh yes, the C++ Primer Plus is definitely an awesome book, it really covers just about everything in C++ and even goes a bit into some data structures like Linked Lists. If you can afford the Fourth Edition, go for it.

Dammit, I'm going on a ramble again :biggrin: , that's what you get for doing nothing but programming since May. Right now I'm trying to understand how BSP trees work to see if I could use one for the game engine I'm writing for my group's final project.
Re: C++ compiler Posted by matt on Sat Jan 17th 2004 at 8:21pm
matt
1100 posts
Posted 2004-01-17 8:21pm
matt
member
1100 posts 246 snarkmarks Registered: Jun 26th 2002 Occupation: Student! Location: Edinburgh
/*
TOP SECRET Microsoft(c) Code
Project: Chicago(tm)
Projected release-date: Summer 1998
*/

#include "win31.h"
#include "win95.h"
#include "evenmore.h"
#include "oldstuff.h"
#include "billrulz.h"
#define INSTALL = HARD

char make_prog_look_big[1600000];

void main()
{
while(!CRASHED)
{
display_copyright_message();
display_bill_rules_message();
do_nothing_loop();
if (first_time_installation)
{
make_50_megabyte_swapfile();
do_nothing_loop();
totally_screw_up_HPFS_file_system();
search_and_destroy_the_rest_of_OS/2();
hang_system();
}
write_something(anything);
display_copyright_message();
do_nothing_loop();
do_some_stuff();
if (still_not_crashed)
{
display_copyright_message();
do_nothing_loop();
basically_run_windows_3.1();
do_nothing_loop();
do_nothing_loop();
}
}

if (detect_cache())
disable_cache();

if (fast_cpu())
{
set_wait_states(lots);
set_mouse(speed, very_slow);
set_mouse(action, jumpy);
set_mouse(reaction, sometimes);
}

* printf("Welcome to Windows 3.11"); *
* printf("Welcome to Windows 95"); *
printf("Welcome to Windows 98");
if (system_ok())
crash(to_dos_prompt);
else
system_memory = open("a:\\swp0001.swp", O_CREATE);

while(something)
{
sleep(5);
get_user_input();
sleep(5);
act_on_user_input();
sleep(5);
}
create_general_protection_fault();
}

is what I say to windows programming!
Re: C++ compiler Posted by Crono on Sat Jan 17th 2004 at 9:54pm
Crono
6628 posts
Posted 2004-01-17 9:54pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
ha ha ->matt. I wonder if everyone will understand after reading that . . .

Devloping non-object oreiented stuff in C++ is bassically the same as developing in C. If you wanted it to run efficiently and fast, use OOP. I mean, jesus the only difference really is the compiler, the languages aren't as different as you guys are saying, a 3rd of C++ is C, even now.

The primer rules indeed . . . didn't I suggest getting a used copy? I thought I did . . . hmm. Well if I didn't . . . look for a used copy, it will be very cheap. Get ready to learn what an array REALLY is lol.

By the way, I know no one has mentioned this, but. If you ever want to use Java, use JAVA, and not something like C#. Even though they are different languages, C# is like MS's version of a Manditory Object Oriented Programming Language . . . and we all know Sun blows Microsoft Away.

Oh, if you really hate Microsoft and you're not inept in Unix, try building a practice 'box' putting Linux on it (I suggest SuSe any version it would be best to go after 7.2). It's free, it's better/faster/more reliable/gives more control. Then for the applications you want to run that are from windows, install Wine, or Wine-X. I think most every program works. . . except hammer lol. Because wine isn't an emulator and all sorts of crap. But there's a butt load you can do. Like download apache (which is also free) and set your self up a web server for your own site.
And if you try out Linux you'll find sweet security. (unless you insist on being logged in as root all the time.)

I've rambled long enough.
Re: C++ compiler Posted by Forceflow on Sat Jan 17th 2004 at 10:16pm
Forceflow
2420 posts
Posted 2004-01-17 10:16pm
2420 posts 451 snarkmarks Registered: Nov 6th 2003 Occupation: Engineering Student (CS) Location: Belgium
Lol, Matt. (I do understand it.)

And Mandrake Linux runs great, too.
Re: C++ compiler Posted by Leperous on Sat Jan 17th 2004 at 10:34pm
Leperous
3382 posts
Posted 2004-01-17 10:34pm
Leperous
Creator of SnarkPit!
member
3382 posts 1635 snarkmarks Registered: Aug 21st 2001 Occupation: Lazy student Location: UK
## top secret Lunix code, original non-Unix code really!

require command_prompt('1980s');
require special_lunix_version_of_program('rare');

while doing_some_stuff_windows_can_do_anyway() {
inflate_user_ego('nerd');
make_random_kernel_errors('fnarg','unf');
be_sued_by_sco('$10000000');
end_up_nowhere_really('quickly');
switch_desktop('no reason','use a taskbar');
support_communism();
}

Yeah I know it's not C++, but I'm a PHP man :razz:
Re: C++ compiler Posted by Forceflow on Sat Jan 17th 2004 at 10:43pm
Forceflow
2420 posts
Posted 2004-01-17 10:43pm
2420 posts 451 snarkmarks Registered: Nov 6th 2003 Occupation: Engineering Student (CS) Location: Belgium
lol Lep
Re: C++ compiler Posted by Edge Damodred on Sat Jan 17th 2004 at 11:30pm
Edge Damodred
237 posts
Posted 2004-01-17 11:30pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
Hehe Lep, I'd have to agree with that.

It's funny, people hate MS, but when it comes to DX, they almost seem to worship it. Most of DX is okay, except D3D, I fricken hate programming for it. <OGLFANBOYISM :biggrin: >OGL all the way!!! </OGLFANBOYISM :biggrin: >

Actually, I'll get around to restudying D3D, but I do like OpenGL oh so much better.
Re: C++ compiler Posted by OtZman on Sun Jan 18th 2004 at 12:19am
OtZman
1890 posts
Posted 2004-01-18 12:19am
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
Edge Damodred said:
but yeah, to see if it's in ASCII, use the for loop and modify the output statement slightly to see the corresponding numbers

cout<<"\\n"<<(char) i <<'\\t'<< i;

Oh, for single characters and escape sequences(anything that starts with \\), you can just use a single quote.

To print out the character '', you'll have to do '\\' to get the compiler to shut up about illegal escape sequences and stuff, even when you send in directory strings as well.
Wow, thx Edge Damodred, now I can make ?, ? and ? and whatever I want! :biggrin: Thx a lot!! :smile:

*EDIT*\\

What was that thing you were talking about I had to adjust?:
Edge Damodred said:
How to make those appear on purpose or on accident.

On accident it's just random chode(garbage) that was picked up in the memory that that was grabbed and it interprets it as characters.

but yeah, to see if it's in ASCII, use the for loop and modify the output statement slightly to see the corresponding numbers
I just noticed that the numbers in the ASCII chart didn't represent the right letters correctly. Is there a way to adjust them so they do?

/*EDIT*
Re: C++ compiler Posted by OtZman on Sun Jan 18th 2004 at 2:08pm
OtZman
1890 posts
Posted 2004-01-18 2:08pm
OtZman
member
1890 posts 218 snarkmarks Registered: Jul 12th 2003 Occupation: Student Location: Sweden
This ASCII thing makes no sense at all! :leper: It's totally illogical. The numbers seem to have nothing to do with the letters. I also checked http://www.asciitable.com and it was the same thing there. Totally illogical. :mad:
Re: C++ compiler Posted by Edge Damodred on Sun Jan 18th 2004 at 7:04pm
Edge Damodred
237 posts
Posted 2004-01-18 7:04pm
237 posts 54 snarkmarks Registered: Apr 24th 2002 Occupation: student Location: I don't even know anymore
Welcome to programming :biggrin: