Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2007
    Posts
    592
    Rep Power
    83

    Just starting C / C++...


    Hi there!

    I am a brand new, C/C++ newbie... Application-development newbie, actually. I rock HTML, CSS, PHP, and MySQL, but that's basically all i know, but I'd like to enter the realm of applications.

    So, my question is... How do you recommend I get started? I downloaded and installed the Borland compiler, and have Notepad++, (which I really like) but don't know how to do anything... how do you recommend I go from Zero to Hero? What should I learn, practice, create...?

    I tried a little bit of Python, so I *sort of* got the idea of what applications are... but what can you do with the command line? Not a lot... my goal is to create some fancy GUI things. How do I get started?

    Thanks a lot!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2006
    Posts
    2,254
    Rep Power
    1741
    How do you recommend I get started?
    Question if you really want to get started with C or C++. Itís not a fast track to applications development. Java and C# are much better choices. Besides, you tried to work with Python. Why donít you continue? I think itís your fastest path to creating applications, plus itís the most useful language in your toolbox, given your web-development focus. You can read this forumís, other forumsí, or the internet as seen by Google to see the general opinions on the various languages.

    If you do hold fast to C/C++, the first step would be to pick C or C++. There is no language called C/C++ and attempting to learn it will result in a miserable failure. I more or less recommend starting with C++, and moving to C or the C subset of C++ after some considerable experience with the C++ language.

    but don't know how to do anything... how do you recommend I go from Zero to Hero? What should I learn, practice, create...?
    Donít you have a book or tutorial that you are trying to learn from? Youíre generally not going to know what to do unless you start reading documentation and learning resources.

    but what can you do with the command line? Not a lot... my goal is to create some fancy GUI things. How do I get started?
    Ah yes, you make a pronouncement about the commandline, displaying limited knowledge about it yourself.

    But if you imagine yourself jumping into fancy GUIs and the like, you really should reconsider C++ (and definitely C).
    When you ask a question, be prepared to tell us: what have you tried? If you think you don't need to try anything, we will never be interested in helping you. If you agree with the link, and you refuse to answer that question, you are being a hypocrite.

    Need help with broken code? Your question should be like a good bug report: (1) It has the smallest number of steps to reproduce the problem you see (2) It tells us precisely what you expected to see and (3) It tells us what you saw and how it differed from what you expected. We need all three to help you.
    Want better answers? Tell us what you Googled for and what steps you took to answer your own question.
  4. #3
  5. Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jun 2005
    Posts
    5,929
    Rep Power
    4856
    You can get GUI libraries (wxWidgets, et.al.) for Python. Why did you jump from that to C++?
    Write no code whose complexity leaves you wondering what the hell you did.
    Politically Incorrect DaWei on Pointers Grumpy on Exceptions
  6. #4
  7. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,119
    Rep Power
    1806
    Well, I probably would not start with the "Borland compiler" and Notepad++. What is the "Borland compiler" in any case? There have been many over the years, and both old and new ones are available to download for free.

    MSVC++ 2008 Express Edition is a good tool, allowing you to do C, C++, C++/CLI, Win32, .NET, Windows Forms, as well as third party libraries such as wxWidgets. THe path of least resistance for .NET and Windows Forms however is probably C#, there is an free Express Edition tool for that too.


    Clifford
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2007
    Posts
    592
    Rep Power
    83
    What language do you guys recommend for GUI? I know Python can do it, but I'm not sure how well. One thing I'd like to be able to do (not planning on reproducing it, but just as an example...) is create something similar to the Yahoo! Widget engine. I'm not planning on creating that, but the way I see it, if I can do that, I could do anything I wanted. :P

    And no, I don't have any resources in mind. I learned web development off of a number of different websites I could look up. No books or anything.
    Last edited by Dekudude; June 9th, 2008 at 01:53 PM.
  10. #6
  11. Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jun 2005
    Posts
    5,929
    Rep Power
    4856
    You better get some books (or other suitable references). You ain't in Kansas anymore.
    Write no code whose complexity leaves you wondering what the hell you did.
    Politically Incorrect DaWei on Pointers Grumpy on Exceptions
  12. #7
  13. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Alpharetta, GA
    Posts
    1,809
    Rep Power
    1574
    I would stick with Python, realistically. While it is a bit hairy for GUIs (more because there are several to choose from than because of any issues with the language), it is still vastly easier than most of the alternatives, and while you may not have gotten very far in it yet, it will do you well in the long run.

    I would strongly recommend learning more about the command line, and especially the Linux shells (BASH and C-Shell) if you can (the Cygwin tools do a fair job of emulating bash under Windows). There is actually a great deal you can do with the command line - it can be more flexible than GUI, in fact - it just takes more knowledge and experience to use effectively. Like with many other 'for your own good' things, learning shell will make you a better programmer and user even if you never use it regularly.

    If you are determined to learn GUI programming for Windows, C# is said to be an excellent choice (I don't know enough about it personally to say). Java is somewhat less friendly, apparently, but works on non-Windows systems and is very flexible. However, Python would still be my recommendation, overall, since it is much easier to learn. As I have said to others, you can probably learn Python and then learn C++ in less time than you could learn just C++.
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in Short ē Understanding the C/C++ Preprocessor
    Taming Python ē A Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
  14. #8
  15. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2007
    Posts
    592
    Rep Power
    83
    How flexible IS the command line? I've looked stuff up on it, and all I've ever seen is how to shut down windows, and batch rename / copy files... very little else.

    Where do you recommend I go to learn it?
  16. #9
  17. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,325
    Rep Power
    2227
    The command line is so powerful that when you want to secure a computer for use by the general public, the very first thing you do is to lock them out of the command line. Because when presented with a GUI, you can only do what the GUI allows you to do. But when you can get to the command line, nothing is out of your reach. To get something done, you don't have to go searching all around to figure out where Microsoft is hide that feature in this version, assuming that they even allow you to do at all. No, all you need to do is to tell the computer to do what you want it to. GUI? We don' need no stinkin' GUI!


    Besides, while you learn C and/or C++, most of your apps will be console apps, which are best run from the command line.
  18. #10
  19. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,119
    Rep Power
    1806
    Originally Posted by Dekudude
    How flexible IS the command line?
    If you mean can you write programs as shell scripts, well in Windows using the default cmd.exe shell, no not really, Windows batch files are very limited in capability compared with Linux shell scripts for example. But I don't think you really meant the command line, but rather console or character mode applications (which is not the same thing at all!).

    Console mode applications can be as flexible as your imagination. The advantage of learning C++ (or any other language for that matter) with simple console I/O is that it is largely platform independent, so you will be learning the language itself rather than the vast operating system and GUI API, moreover for any platform there is generally more than one GUI API or framework to choose from (e.g. MFC, Windows Forms, wxWidgets, Qt, KDE, KDE, Gnome, Cocoa, Carbon, Allegro etc.)

    You are probably better off in the long term getting moderately good at the language (understanding its syntax, semantics, constructs and paradigms) ,then learning GUI development (the preferred technology for which often changes rapidly. For example Win32 was largely succeeded by MFC, and then .NET, with a large number of other associated technologies introduced along the way), rather than jumping in at the GUI deep-end and becoming merely mediocre at the language.

    You may not set the world on fire with your vanilla console apps, but you will be a stronger developer for only having to concentrate on one thing at a time, and moreover will better understand the separation between language and platform.

    As an example of how powerful a console app can be, here's my personal favourite (you have to be pretty long in the tooth perhaps, and remember the original MS-DOS app of which this is an extended clone, to really appreciate how powerful this is, but I use it all the time).

    ISO standard I/O can be a bit of a limitation, really only allowing an interface style known as 'glass teletype', but the Windows OS has a far more powerful console I/O API: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Similar capabilities are available on other platforms via libraries such as curses and its various clones.

    Clifford
  20. #11
  21. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2007
    Posts
    592
    Rep Power
    83
    Okay, so you can do a lot of stuff with the command line. :P Can you do the same command-line stuff with Python? When I was using Python, I saw that it was a bit different (type exit() to exit, for example... not just 'exit'.)

    Using the command line, can you literally do almost anything? Meaning, with the command line, could you access Microsoft same, and have him say stuff? Minimize OTHER windows you have open?

    Also, assuming I were to write something that opens in the command line, would there be any way for me to disallow functions (like exit) from being used, forcing only the ones I built in to work?
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2006
    Posts
    2,254
    Rep Power
    1741
    Using the command line, can you literally do almost anything? Meaning, with the command line, could you access Microsoft same, and have him say stuff? Minimize OTHER windows you have open?
    Now, youíre getting the wrong idea about the command line. Itís an alternative interface. Itís also the simplest interface you can work with, because setting up a GUI is intensive work, which may not be necessary. Iím mildly surprised you are so unfamiliar with the GUI, because when you run your own development server (for web development), you may have to get a bit familiar with the command line to use Apache, MySQL, etc.. The commandline isnít some supertool.

    Stop trying to think about ďwhat can I do with the commandlineĒ and just keep programming. Experience with third party development tools, as well as writing your own programs, will give you an appreciation for why the commandline exists.

    Can you do the same command-line stuff with Python? When I was using Python, I saw that it was a bit different (type exit() to exit, for example... not just 'exit'.)
    Uh, are you talking about the Python interpreter? Thatís something different altogether. Itís an interactive interpreter, where you type in code, and get immediate results from Python. Itís not a commandline, although you do invoke it through the commandline interface.
    When you ask a question, be prepared to tell us: what have you tried? If you think you don't need to try anything, we will never be interested in helping you. If you agree with the link, and you refuse to answer that question, you are being a hypocrite.

    Need help with broken code? Your question should be like a good bug report: (1) It has the smallest number of steps to reproduce the problem you see (2) It tells us precisely what you expected to see and (3) It tells us what you saw and how it differed from what you expected. We need all three to help you.
    Want better answers? Tell us what you Googled for and what steps you took to answer your own question.
  24. #13
  25. Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jun 2005
    Posts
    5,929
    Rep Power
    4856
    You are obviously unfamiliar with what a computer actually is and how it, with the help of a programmer, gets the job done. I seriously recommend that you go do some reading. Popping questions into a forum is a good way to get guidance regarding specific problems, but it is a helluva poor, inefficient way to learn.

    That's presuming that one can research, read, and comprehend, of course. Perhaps I'm expecting too much of the entitlement, sugar-tit generation.

    Comments on this post

    • m_naseer disagrees
    Write no code whose complexity leaves you wondering what the hell you did.
    Politically Incorrect DaWei on Pointers Grumpy on Exceptions
  26. #14
  27. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,119
    Rep Power
    1806
    Originally Posted by Dekudude
    Okay, so you can do a lot of stuff with the command line.
    You seem to have missed my point about terminology and persist in referring to the "command line". If you want to be sure of accurate answers you have to ask accurate questions.

    Originally Posted by Dekudude
    Meaning, with the command line, could you access Microsoft same, and have him say stuff? Minimize OTHER windows you have open?
    ... as well as accurate, questions also have to make sense in at least one Earth based natural language!
    Originally Posted by Dekudude
    Minimize OTHER windows you have open?
    Not if they belong to a different process, without a mutually agreed inter-process communication mechanism between them! Actually it probably is possible, but wouldn't it be an annoying application that messed with applications that were none of its business. In fact more than annoying; more insidious, most users would uninstall the application immediately.

    Originally Posted by Dekudude
    Also, assuming I were to write something that opens in the command line, would there be any way for me to disallow functions (like exit) from being used, forcing only the ones I built in to work?
    Uh? C/C++ are compiled languages, they only execute the code you put in them when you build them. If you program has not call to exit() it cannot execute exit()! If this question is directed at Python, you are just on the wrong forum.

    Clifford
  28. #15
  29. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Alpharetta, GA
    Posts
    1,809
    Rep Power
    1574
    I think you are getting a few different things confused, which to be honest isn't so unusual; a lot of newer programmers get thrown by the console from lack of experience. Hold on and I'll explain a few things about it.

    First, a bit of a history lesson. When computers started out, there were a number of different ways to send commands and get back data, but most of them were batch-based; that is to say, you typed in the program on some special piece of hardware, which wrote it to a paper tape or punch card or something similar, and then handed it to the system operator, who would run it sometime later... when they got to it... which could be a long while. If you had a lot of things to do, you might have a job control script which ran the set of programs in the right sequence, though often you would have to ask the operators to do it for you and hope they understood what you wanted. When it was finished, if you were lucky and it didn't crash, you got back a printout or a stack of cards which you would go over to see if it came out the way you wanted it to.

    At the time, the most common 'interactive' way of working with the system - usually reserved for the operators, unless you were lucky enough to be somewhere that either had a mini (a 'small' computer, about the size of a refrigerator) which you could run yourself, or a big timesharing system with many terminals - was through a teletype, which was a combination typewriter/print. You would type in your commands, the teletype would send it to the computer (which was usually somewhere else entirely), and it would send back a response that it would print out. This was the standard way of working from around 1965 to nearly 1980, and lingered in places until the late 1980s. The next step up was a terminal, which was basically the same thing with a screen instead of a roll of paper; over time, they came to be able to do things like move the cursor around the screen, but for the most part, they were basically virtual printers. These were the consoles, though that term was often reserved for a privileged terminal which only the operators had access to.

    When you were using one of these systems, the default interface was the command interpreter, or shell. This was a program - sometimes part of the operating system, sometimes just a regular program - which would read in what you typed and tried to execute it. Most shells had a few built-in commands, but the main purpose of the shell was to launch other programs. You would type in, say,
    Code:
    type quux.txt
    and it would run the program 'type', passing it the command-line argument 'quux.txt', and the program would do whatever it is you wanted it to do to (hopefully). You would usually have some way to to view the directory structure and move around in it, as well as see where you are in it. There were often was of combining commands so that the output of one would become the input of another (called pipes, an innovation from Multics that became a key component of Unix and later spread to other systems). Finally, if there were commands you needed to run frequently, you could write a list of commands into a file - a batch file or shell script - which you could then tell the shell to run automatically, as if you were typing it in yourself.

    This is more or less how the command console in Windows works today. In fact, the example I gave is a Windows console command, one which (not surprisingly) types the file 'quux.txt' to the console. Different systems had (and have) different command interpreters, and some, such as the original Apple II, used a language interpreter (more on that in a moment) that doubled as a command interpreter.

    The point is, the command line itself is mostly a way of running other programs, but the same can be said of the Start menu and the Windows Explorer. In fact, a Windows shortcut can be thought of as a special type of batch file. If you right-click on a shortcut icon, go to 'Properties', and look at to the 'Shortcut' tab, you'll see the actual command line which starts the program, including the arguments which it is running - and you can make different shortcuts for the same program with different arguments if you want.

    Similarly, when you click on a file, Windows looks at the file extension, and looks up the program that it uses to read that type of file (you can see a list of these in My Computer->Tools->File Types, and you can edit the list if you want) and runs it; it's the same process, really, it just automates the whole thing for you.

    More or less any Windows program can be started from the console, if you know where it is in the file directory; but a program designed to run in the GUI will usually start up a window of it's own if it can, and henceforth act the more or less the same as if you'd clicked on a shortcut to it. A lot of GUI programs have command arguments, buried out of view in the console, which you can use if you know how.

    Now, there had to be some way to write new programs, or else you wouldn't be able to do very much; most systems, even today, have only so many things bundled with them (most of what you probably think of as 'Windows' are actually separate programs). To do this, you usually would have one of two things, or some combination of them: either a text editor and a compiler, or an interpreter with a listener.

    The editor/compiler approach is more or less what you would expect: you write a program in the editor, save it to a file, then run the compiler and linker to get an executable program. This is how C and C++ work; while most current systems combine the editor and the compiler in what is called an 'Integrated Development Environment', so that you can type in the program, compile it and run it without having to leave the editor, but underneath it all they 'really are' separate programs (or at least two separate functions of the IDE, plus the program you've written). the result of this is a program you can run... from the command console.

    The other approach is to have an interpreter, which can read in a program file and execute the program right then and there. These days, most interpreters can be run from the console by typing the name of the interpreter program, then the name of a program to run:
    Code:
    python foo.py
    will run tell the Python interpreter to run a program called 'foo.py', something you've probably already seen. However, many also have another mode, one which acts like a command interpreter but using the language statements instead of the command language. If you run the Python interpreter from the console without a file name, you'll see it. If it seems familiar, it should: this same thing you got when you ran IDLE, which is pretty much just a wrapper around the Python listener. You can write lines of code and functions in the listener, and some allow you to save from it too (Python doesn't, however), but the main purpose of the listener is to let you experiment with things: you can run a few lines of code at a time, without having to write and save a whole program. You can even use it as an alternative to the command interpreter to some degree - in fact, some older systems, like the Apple II, had an interpreter instead of a separate shell (back in the day, these were often either BASIC or FORTH interpreters). There are usually ways of going out to an editor from the listener, which let's you write and save the program, or even just part of it, when you need to.

    Well, now that I've bored you to deathexplained the origin and purpose of the command interpreter, you should have some idea of what it is and can do. Any questions?

    Comments on this post

    • sizablegrin agrees : frikkin' excellent
    • ryon420 agrees : Bookmarked and saved.
    • medialint agrees : where's the wagon? I'm with the band ..
    • kicken agrees
    • benno32 agrees
    • f'lar agrees
    • gimp agrees
    • Joseph Taylor agrees : Excellent post, as usual.
    • LaughingBelly agrees : Excellent!
    • Xyteran agrees
    • codergeek42 agrees : +++++
    Last edited by Schol-R-LEA; June 10th, 2008 at 08:30 PM.
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in Short ē Understanding the C/C++ Preprocessor
    Taming Python ē A Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo