Am I learning out-dated code?

This is a discussion on Am I learning out-dated code? within the C++ Programming forums, part of the General Programming Boards category; I'm new to programming (About as new as you can get) and I found this website so I figured maybe ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    4

    Am I learning out-dated code?

    I'm new to programming (About as new as you can get) and I found this website so I figured maybe I could finally learn something about coding.

    I downloaded DevC++ compiler as the website instructed and suggested. I started my endeavors by trying to complete the tutorial steps off the web page and kept running into problems. I gave up after about an hour and my parents kicked me offline anyway. Since I had no internet I started messing around with my new compiler (DevC++) and I discovered that there were tutorials that were remarkably similar under the help tab in DevC++ itself. So I started following the tutorials that I found in the DevC++ help file.

    Here is where the problem arises, after I started following the directions from the help file in DevC++ I had no problems when trying to compile and run my code. later I looked at the differences in the code from this website's tutorials and the tutorials I found in the help file. The largest notable differences in code were the use of

    #<iostream> instead of #<stdio.h>
    cout<< and cin>> instead of printf and scanf

    I'm wondering why I'm learning something different from the tutorials included in the compiler than from those included on the website. I'd just like to know if there's any sort of problem with this and if so, how do I fix what I'm doing wrong. The compiler won't seem to run or compile the code off the website.

    I hope I have been clear and to the point, if you can offer me any help it would be greatly appreciated.
    Last edited by JustinAllard; 11-29-2005 at 07:21 PM.

  2. #2
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    cout << and cin>> are C++
    printf and scanf are C

    same for the libraries (<iostream> for C++ and <stdio.h> for C)
    My Website
    010000110010101100101011
    Add Color To Your Code!

  3. #3
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,077
    By convention, the stdio.h and stdlib.h libraries, as well as many others are considered C code not C++. While it is all valid in C++, the more recent libraries are designed differently and perform different operations more efficently. If you check the C forum on this message board, you'll see code much more similar to the Dev-C++ tutorials.
    Sent from my iPadŽ

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    4
    Hold on, it can't be that simple. If that's true why is the program I downloaded called "DevC++" and why isn't it accepting the C++ code from this website, then?

    (I even tried copy and pasting the code after many frusturating attempts at fixing my errors, the compiler just doesn't seem to want to take <iostream> Is this going to be a large setback?)
    Last edited by JustinAllard; 11-29-2005 at 07:36 PM.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    You might not have set it up correctly. Or maybe you downloaded an old version that uses outdated C++ (like <iostream.h>).

    Which version of Dev-C++ do you have and what problems did you get when trying the code?

  6. #6
    Registered User
    Join Date
    Nov 2005
    Posts
    4
    Hold on a minute, I'll get specifics. (Or I'll try to get something to help you, help me solve my issues.) =P

  7. #7
    Registered User
    Join Date
    Nov 2005
    Posts
    4
    I have Dev-C++ 4.9.9.2, and I think I just wasted alot of your time. It seems to be reading cout<< and cin>> fine now. Terribly sorry ^.^~

    (Still, is this the most recent version?)

    Thanks a bunch for all your help and quick response, even though it was my own fault. I must not have seen something. At least I know now that I can come to these forums for reliable help if ever the ailments of programming plague me again.

    ^.^ You guys are great.
    Last edited by JustinAllard; 11-29-2005 at 07:48 PM.

  8. #8
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,077
    That's the version I have. Whether it's the most recent I don't know, but I haven't heard of any signifcant changes since I downloaded it.
    Sent from my iPadŽ

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    > I even tried copy and pasting the code after many frusturating attempts at fixing my errors
    Posting your code and your errors when you next get stuck would be a big help.

    Also, consider what filenames you use.
    prog.c would normally be compiled as a C program
    prog.cpp would normally be compiled as a C++ program

    Dev-C++ is merely the name of the IDE which integrates the editor, compiler, debugger into a single package.

  10. #10
    Programmer
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    33
    For a small test to see if it works, make a new Empty Project, then Add a New Source then copy and paste this code I just wrote and compile and run.

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        cout << "Dev C++ Works!\n";
    
        cout << "Press Enter To Quit ... ";
        cin.get();
    
        return 0;
    }
    I wouldn't blame Dev C++ for not working right, like others have said C is what your going to find in the Dev Tutorials.

    Code:
    #<iostream>
    Is not vaild, it needs to be like whats in my small example. Make sure when your using:

    Code:
    cout << "Text";
    Your using the ";" at the end.

    I'm pretty new at C++ as well, you will find it a lot easier to get a good book then work on online tutorials to learn.

    Good Luck!
    (Expert Visual Basic Programmer)
    (Newbie C/C++ Programmer)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Am I learning out-dated code?
    By c777 in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 06:53 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  3. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 02:37 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21