Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / C++ is weird!!

Author
Message
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 8th Aug 2004 16:28
i just got dev-c++ 4.....do they try to make the commands as confusing as possible? how can anyone get around with this?....maybe im just used to DBPro, nice and simple, but does anyone know where there are some good c++ tuts?? preferably explaining all the different kinds of apps too (console apps, window apps, etc)

thanks,
Bishop

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
stealth
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: New Zealand
Posted: 8th Aug 2004 16:52
C++ isnt really that hard , theres tuts that teach u the basics in 21 days , which is all u need , u can learn it real quick , once I've finished my projects I might possibly write a tutorial of what I know , the hardest part of learning C++ is no documentation , especially with DevC++ , since it's just an IDE they dont provide u with a hell of alot of information , different compilers/IDE's will cause alot of confusion , so stick with DevC++ for now , u can get tutorials here

http://www.cprogramming.com/tutorial.html

here

http://www.cprogramming.com/tutorial.html

here

http://www.cplusplus.com/doc/tutorial/

and u can get help from this forum

http://www.gamedev.net/community/forums/


^^These guys are quick wit replies

after u learn some basic stuff and u wanna get into a little more advanced stuff check the examples provided with DevC++ ( should be in C:\DevC\Examples )

u got alot of learning to do , u'll get confused because things are done differently in C++ , but its not that hard really , u just need to know what functions to use/call and where u use them and what they do .. thats what i meant by documentation , they dont give u an explanation about the functions with DevC++ , but if u go to MSDN.com u can search the database for any information regarding C++ functions

Powersoft
21
Years of Service
User Offline
Joined: 1st Aug 2003
Location: United Kingdom
Posted: 8th Aug 2004 17:45
dload the updates and there is a gui designer i think


Create or Play? You choose!
The Real 87
20
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 9th Aug 2004 17:03
Take a class. The hardest thing about C++ is the libraries, once you have them nailed it isn't too much different from basic, instead of print you use cout >> and instead of ; you use >>.

I have only taken a semester of C++ so don't come to me with C++ questions.

Check out my RPG at
www.stickz.tk
Zero Blitzt
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 9th Aug 2004 17:06
You mean cout << ""; .

[center]
Rush owns--> www.Rush.com ---> I'm going to see them Aug. 7
Come to #coding. We promise we wont kick you!
TheAbomb12
21
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 9th Aug 2004 17:35
Quote: "instead of ; you use >>."


you never use >> in place of semi-colons

Amist the Blue Skies...
The Real 87
20
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 9th Aug 2004 19:27
yes you would, for example
print "a"; a; " b"
would be
cout << "a" << a << " b"

@it's been a while since i have used C++

Check out my RPG at
www.stickz.tk
stealth
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: New Zealand
Posted: 9th Aug 2004 20:10
^^cout is a very very very small part of C++ , the hardest parts are knowing where to find the functions u need , the name of the functions and how to use them , theres heaps and heaps of libraries in C++ , u have to actually start reading and trying , trial and error , try the links I gave u , u can learn alot from tutorials on the net
DrakeX
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 9th Aug 2004 23:06
the biggest thing to overcome with C++ is the fact that the language itself does absolutely nothing. what an absolute shock it was to me to find that there were no built-in functions and that the functions were all in header files and library files!

another irritating thing is the lack of really any useful documentation for most of the default functions (called the "runtime library"). thankfully i have a book called "C quick reference", which is a bit dated, but is great for finding out what all those weird-named functions do. and what functions are actually available.

you might also try going to microsoft's site and go on MSDN.. see if you can find stuff relating to C++. MSDN is a fantastic resource if you can ignore all the .net crap.

OK enough of that damn DBP fanboy banner. i'm NOT a DBP fanboy in any way. i haven't used DBP in over a year, and i don't really plan on using it again.
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 10th Aug 2004 02:41
lol, i just got Dev C++. The features are ok, but its maaaddd confusing at first. Your right. No built in functions what so ever. It takes about 100 lines of programming to make a window appear and by then your brain hurts and you wana give up.

-My Game Website:--------------------|
http://www.freewebs.com/mycpugames/
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 10th Aug 2004 02:44 Edited at: 10th Aug 2004 02:54
Eek... THis is hard.

-My Game Website:--------------------|
http://www.freewebs.com/mycpugames/
TheAbomb12
21
Years of Service
User Offline
Joined: 14th Aug 2003
Location: Amist the blue skies...
Posted: 10th Aug 2004 02:48
Quote: "yes you would, for example
print "a"; a; " b"
would be
cout << "a" << a << " b""


I take it you are talking about basic progamming. In any case, the semi-colons are not the equivelent of "<<", the semi-colons tell the basic program to print on the same line where as the << seperates the messages and varables.

A semi-colon is always used at the end.

cout << "a" << a << " b\n";

Amist the Blue Skies...
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 10th Aug 2004 03:07
Argh, can someone please tell me whats with this code:

#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[])
{
char Quit;
while(Quit = false)
{
cout << "This is a DOS app. Type 'End' to end" << end1;
}
return 0;
}

Thanks. lol

-My Game Website:--------------------|
http://www.freewebs.com/mycpugames/
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 10th Aug 2004 03:08
Thats it... Im goin back to DBP. its way easier and 2x the fun to make games with... No x6.

-My Game Website:--------------------|
http://www.freewebs.com/mycpugames/
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 10th Aug 2004 03:09 Edited at: 10th Aug 2004 03:11
Yes, semi-colons are ALWAYS put at the end of EVERY line in C and C++ -- get this straight.

Also, like was said, COUT and CIN are very small things in C++. You can't just say "You use <insert command> in DBP which is exactly compared to <insert command> in C++"... it's much more than that.

C++ is object oriented, for one thing, and DBP is not. C++ has advanced topics like pointers, linked lists, inheritance, polymorphism, classes, references, friend functions, overloading, templates, etc. etc. etc.

And NO, I don't recommend getting a "Learn C++ in 21 days" book, because you will most likely get overwhelmed. Get a regular C++ reference book which goes through everything. I wouldn't worry about Windows/MFC programming until you've already grasped C++. Stick with console (command prompt) stuff until you get the hang of it.

EDIT:

Oh yeah, and C++ has multi-threading capabilities... something which DBP can only have wet dreams about...

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 10th Aug 2004 04:31
Quote: "Oh yeah, and C++ has multi-threading capabilities... something which DBP can only have wet dreams about..."


Sorry but that would be "Windows has multi-threading capabilities". It's nothing specific to C++ at all.

"I am not young enough to know everything."
- Oscar Wilde
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Aug 2004 04:47
There's not even a C++ standard library yet for multithreading.

There is a library being proposed for inclusion in the next standard, but that will be an optional library, only supported for systems that already contain multithreading capability.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 10th Aug 2004 06:15
Quote: "Sorry but that would be "Windows has multi-threading capabilities". It's nothing specific to C++ at all."


Doh--- only in multi-threading capable OS' (e.g. Windows)... I usually niggle something up in these "look at me I'm so smart" type threads

Jimmy
21
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 10th Aug 2004 06:48
DBP has multithreading capabilities...


http://www.dbspot.com/ - Free website hosting. Fast and reliable... probably.
DrakeX
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 10th Aug 2004 06:52
" Argh, can someone please tell me whats with this code:"

just so you know, in C++ variables are *not* initialized to 0 like in DBP. they are not initialized in fact, so they simply hold whatever value was on the stack / in memory before them. so in your code you would have "char Quit=0;" instead.

and it wouldn't end if you typed end

OK enough of that damn DBP fanboy banner. i'm NOT a DBP fanboy in any way. i haven't used DBP in over a year, and i don't really plan on using it again.
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 10th Aug 2004 08:40
Quote: "DBP has multithreading capabilities... "


Ummmm... no it doesn't....*




*does it?

Major Payn
20
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 10th Aug 2004 13:36
I just bought "sams teach yourself C++ in 21 days", that plus a bunch of C++ books a forum member is sending me, and I think I will be set to learn!

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Aug 2004 15:09
hmmm....amazing how many posts there were in one day ...thanks for those recources, i will check them out.....one thing i would like explained is the different kind of apps.....thanks again

Bish

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 10th Aug 2004 15:52
Quote: "[quote]DBP has multithreading capabilities..."

Ummmm... no it doesn't....*




*does it?[/quote]

Yes, it does. The same guys who made that DBP OpenGL thing have also added Multithreading support to DBP, I've seen it in action and it works very well and seems incredibly easy to use.


"Computers are useless they can only give you answers."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Aug 2004 18:27
ok problem....

im on the first tut (wow, i dun good ), and this program:

#include <iostream.h>
int main()
{
cout<<"HEY, you, I'm alive! Oh, and Hello World!";
return 0;
}


when i compile it, a screen flashes up, and then disapears... help!!

BTW- im using the bloodshed dev-c++

Thanx

Bish

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Aug 2004 18:31
Quote: "when i compile it, a screen flashes up, and then disapears... help!!"

Two ways around this :

A) Run directly from DOS
B) put a getchar(), getc() or whatever just before the return statement.


Come to the UK Convention on the 23rd & 24th of October
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Aug 2004 19:00
im sorry, i dont understand......what is "getchar()"?

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 10th Aug 2004 19:02
It´s a function. I´ve got the same problem as you. I tried it out and it stopped the dos window from disapearing. Though I didn´t see any text...


Jam on mother f**ker.
Libera tu mente y te liberaras.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 10th Aug 2004 19:04
It is, and I quote :

Quote: "Read a character from a stream (getc, getwc), or get a character from stdin (getchar, getwchar).

int getc(
FILE *stream
);
wint_t getwc(
FILE *stream
);
int getchar( void );
wint_t getwchar( void );
Parameter
stream
Input stream.
Return Value
Returns the character read. To indicate a read error or end-of-file condition, getc and getchar return EOF, and getwc and getwchar return WEOF. For getc and getchar, use ferror or feof to check for an error or for end of file.

Remarks
Each routine reads a single character from a file at the current position and increments the associated file pointer (if defined) to point to the next character. For getc and getwc, the file is associated with stream (see Choosing Between Functions and Macros). Routine-specific remarks follow.

Routine Remarks
getc Same as fgetc, but implemented as a function and as a macro.
getwc Wide-character version of getc. Reads a multibyte character or a wide character according to whether stream is opened in text mode or binary mode.
getchar Same as _fgetchar, but implemented as a function and as a macro.
getwchar Wide-character version of getchar. Reads a multibyte character or a wide character according to whether stream is opened in text mode or binary mode. "



Come to the UK Convention on the 23rd & 24th of October
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Aug 2004 19:15
MIR, may i sea ure code?

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 10th Aug 2004 19:26
nm, i found the problem...i was calling the function right, but i needed to include "stdio.h"....thanx, now it works fine

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 10th Aug 2004 19:42
Here´s the code:
/: C02:Hello.cpp
// Saying Hello with C++
#include <iostream> // Stream declarations
using namespace std;

int main() {
cout << "Hello, World! I am "
<< 8 << " Today!" << endl;
getc()
return 0;
} ///:~
It´s taken from a tutorial found on this site: http://www.BruceEckel.com
I´d recommend it to anyone switching from c to c++ or wants to know more about the organisation side.


Jam on mother f**ker.
Libera tu mente y te liberaras.
Ianhfar
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: UK
Posted: 10th Aug 2004 19:56
Threads like these really bug me....

You need to see the different languages in context
DB,DBP etc. Are geared for Game development
VB geared for Quick UI access to Databases, windows functionality etc.

C is a utility language, and should be treated as such, Unix, Windows and I'm sure DB,DBP wouldn't exist without it, as they are written in it ( using C++ as well),

C++ is the oop extention of C, keeps alot of its utility type language, and providing wrappers for alot of functionality. ie.
MFC is just a bunch of oop wrappers for the underlying C Api's.

C# one step up, but making it even closer to the VB's ease of gui development.

Pretty much what i'm trying to say is, every language has it Pros and cons, you need to look at the requirements of your project to determine what langauge to use.

My advise, don't go learn C/C++, if you feel you can do what you need to do, in something like DBP or even PB then rather use them.

Hell Dragonz43, that is a terrible example of c++

char Quit;
while(Quit = false)

Firstly it always a good idea to initialise your variables.
while(Quit = false) , this is an assignment and not a comparison.
another problem, is your mixing of types, not a good idea, false is boolean and Quit is a char.

Multithreading.....
DirectX is not multithreaded, when dealing with DirectX you have to revert to single threaded calls, IanM correct me if I'm wrong!

Rant over
MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 10th Aug 2004 20:02
I´d just like to add my 2 cents. I don´t actually plan to make anything in c++. I´m just learning it for the hell of it. It would be nice to make a few dlls for DBPro though...


Jam on mother f**ker.
Libera tu mente y te liberaras.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 10th Aug 2004 23:39
i started a book aswell...
a friend of mine gave me borland 3(i think) and it came with a book...


Formerly known as "DarkWing Duck"
Powersoft
21
Years of Service
User Offline
Joined: 1st Aug 2003
Location: United Kingdom
Posted: 11th Aug 2004 00:22
how about adding


SYSTEM("PAUSE");

before the

return 0;

?


Create or Play? You choose!
DrakeX
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 11th Aug 2004 09:44
that works too.

or, include conio.h and use while(!kbhit()); instead.

so many ways to do the same thing!

OK enough of that damn DBP fanboy banner. i'm NOT a DBP fanboy in any way. i haven't used DBP in over a year, and i don't really plan on using it again.
Major Payn
20
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 11th Aug 2004 09:58
Well Im trying to learn it because I want a career in the game business, although I dont want to be a programmer, I know that that is the position that is needed more than any other, the way I see it is that if I become good with C++, gamedesign, 3D modelling, and texturing It will be much easier for me to get a job.

Guns arnt the problem, people are the problems, shoot all the people and guns arnt a problems anymore.
DrakeX
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 11th Aug 2004 10:05
at least if you learn to program you can do more stuff than make games.

then again, artists don't exactly have a niche job either - you would be amazed at how many things a 2d artist can do! someone has to make packaging and labels and logos and all that other crap!

OK enough of that damn DBP fanboy banner. i'm NOT a DBP fanboy in any way. i haven't used DBP in over a year, and i don't really plan on using it again.

Login to post a reply

Server time is: 2024-11-25 20:33:38
Your offset time is: 2024-11-25 20:33:38