Thread: Site tutorials

  1. #1
    Registered User Aalmaron's Avatar
    Join Date
    Jan 2004
    Location
    In front of a monitor
    Posts
    48

    Unhappy Site tutorials

    I'm vary new to C++, and i didnt want to spend any money on books untill i knew i was going to stick with it. so the tutorials on this web site are great. i'm not vary far though.

    but i have a problem runing the tutorial programs. i'm using Dev-C++. and i havnt even been able to get the first example to run, i've tried them all.

    heres the first one.

    Code:
    #include <iostream.h> 
    int main() 
    {
      cout<<"HEY, you, I'm alive!  Oh, and Hello World!"; 
      return 0;    
    }
    thats extramly simple, and i understand how it works and all, but for the life of me, i can't get Dev-C++ to run it.

    i hit the compile button, and what i compile it as doesnt work.

    i hit the run button, and it wont run.

    can someone tell me how to get this to work. how am i suposed to know if i'm understanding the lessons if i can't mess around with what i've learned.

  2. #2
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    you need to give more info, such as:

    1) is it a win32 application project, or a console project?

    2) what errors/warnings is it giving



    however, dont use iostream.h, it is depreciated, use:

    Code:
    #include <iostream>
    using namespace std;
    instead.

  3. #3
    Registered User Aalmaron's Avatar
    Join Date
    Jan 2004
    Location
    In front of a monitor
    Posts
    48
    ok, wo the tutorials on the web site aren't vary good then? because i got that directly from the first one.

    1) i'm a little confused... when i make the new project for it i made is a windows application. is that what you ment? should i make is a console application instead?

    2)i haven't been getting any errors.

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    135
    Another problem you may find with dev-cpp if you run your program from the IDE is that the console window will close when the program terminates, which will be practically immediately for a simple hello world program. There are various simple solutions, one of which is to put the following line just before the return statement.

    cin.get();

    So, one of the two following should compile OK. If neither of them does, tell us what errors you get:

    Code:
    #include <iostream.h>
    
    int main()
    {
        cout << "Hello world." << endl;
        cin.get();
        return 0;
    }
    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
        cout << "Hello world." << endl;
        cin.get();
        return 0;
    }

  5. #5
    Registered User
    Join Date
    Sep 2003
    Posts
    135
    Originally posted by Aalmaron
    1) i'm a little confused... when i make the new project for it i made is a windows application. is that what you ment? should i make is a console application instead?
    Yes, for what you're doing at the moment, create console applications. They'll run in a console window.

  6. #6
    Registered User Aalmaron's Avatar
    Join Date
    Jan 2004
    Location
    In front of a monitor
    Posts
    48
    thank you! both of those worked. i kept getting the dos promt oppen, but it would close right away with the other code. this works fine though. thanks!

  7. #7
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    beat me to it omnius. a reccomendation I have for you aalmaron is to use google, it's a great tool, and almost all the questions you could ever imagine are on some site or another

  8. #8
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Your code is good for beginners. But it's better to use specific stds:

    Code:
    using std :: cin;
    using std :: cout;
    under the includes. But, even better to use them at the time you have them in your code:

    Code:
    std :: cout << "Hello World!";
    std :: cin.get();
    Better, but the code is fine with namespace std.

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  9. #9
    Registered User Aalmaron's Avatar
    Join Date
    Jan 2004
    Location
    In front of a monitor
    Posts
    48
    ok i'll try to google my questions, but i dont think that would have helped me here, since i wanted to know whatw as wrong with the code.

    SirCrono, i'm still a brand new beginer, i dont even know what std is i'll learn though

  10. #10
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Std is short for standard. Correct me if I'm wrong.

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  11. #11
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    The tutorials on this site need to be updated. Unless somebody beats me to it, I'll rework them sometime in the near future and see what webmaster thinks.

    >Std is short for standard. Correct me if I'm wrong.
    Actually, it is short for sanctioned. It's a common mistake, thinking that std is short for standard, but if you compare the dictionary entries, sanctioned is actually a better fit. The Standards committees get a good laugh out of seeing people confuse std with standard.
    My best code is written with the delete key.

  12. #12
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Originally posted by Prelude
    >Std is short for standard. Correct me if I'm wrong.
    Actually, it is short for sanctioned. It's a common mistake, thinking that std is short for standard, but if you compare the dictionary entries, sanctioned is actually a better fit. The Standards committees get a good laugh out of seeing people confuse std with standard.
    Really? I didn't see a smiley so it looks like you're being serious.

    If so:
    Merriam-Webster's Dictionary
    Main Entry: STD
    Pronunciation: "es-(")tE-'dE
    Function: noun
    Etymology: sexually transmitted disease
    Date: 1976
    : any of various diseases transmitted by direct sexual contact that include venereal diseases (as syphilis, gonorrhea, and chancroid) and other diseases (as hepatitis A, hepatitis B, giardiasis, and AIDS) that are often or sometimes contracted by other than sexual means
    -------------------------------------------
    Main Entry: std
    Function: abbreviation
    standard
    -------------------------------------------
    Main Entry: STD
    Function: abbreviation
    Etymology: New Latin sacrae theologiae doctor
    doctor of sacred theology
    ========================
    And at Acronym Finder:
    STD Doctor(ate) of Sacred Theology (degree)
    STD Sexually Transmitted Disease
    STD Standard
    STD Stunde (German: Hour)
    STD Safely Tolerated Dose
    STD Salinity Temperature Depth
    STD Santo Domingo, Venezuela - Mayor Humberto Vivas Guerrero (Airport Code)
    STD São Tome and Principe Dobra (ISO currency code)
    STD Saves the Day
    STD Saves the Day (band)
    STD Scheduled Time of Departure
    STD Science and Technology Division
    STD Second To Die (life insurance)
    STD Security Tools Distribution (Knoppix)
    STD Selective Transmit Diversity
    STD Set Direction Flag
    STD Severe Tire Damage (band)
    STD Short Term Disability
    STD Sigma Tau Delta (Sorority and English Honors Society)
    STD Simplified Trellis Decoder
    STD Single-Trial Decoding
    STD Singly-Testable Dependent
    STD Small Target Detection
    STD Society for Theological Discussion
    STD Software Test Description
    STD Software Test Document
    STD Solar Terrestrial Dispatch
    STD Spatial-Temporal Detector
    STD Standard Offline Test Driver
    STD Standard Trunk Dialing
    STD Standing
    STD Star Destroyer (Star Wars)
    STD State Transition Diagram
    STD Steady
    STD Step Transaction Doctrine
    STD Steward
    STD Storage Technology Division
    STD Stud Book
    STD Student Technical Director
    STD Stunden (German: Hours)
    STD Subscriber Trunk Dialing
    STD Subscriber Trunk Dialling
    STD Swimmer Transportation Device
    STD System Technology Demonstrator
    STD System Test Directive
    STD Systems Target Decoder (MPEG systems)
    ===========================

    No sanctioned. Interesting. Must not have reached popular use yet.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  13. #13
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Really?
    No, not really.

    >I didn't see a smiley so it looks like you're being serious.
    I was taking the "humor by ridiculousness" rather than "humor by smiley" approach. But if you look at the definitions of standard and sanctioned, sanctioned actually does fit better for our use of the term.

    And so as not to confuse anyone further:

    My best code is written with the delete key.

  14. #14
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Um... I'm confused =|. So it does or doesn't. I sort of got it, but um, no... I didn't... So?

    - SirCrono6,
    Last edited by SirCrono6; 01-04-2004 at 07:13 PM.
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  15. #15
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Sexually Transmitted Disease

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  2. Got any tutorials or programs?? Send them to my web site!
    By robmil29 in forum C++ Programming
    Replies: 6
    Last Post: 09-27-2004, 11:38 AM
  3. Best way to organize tutorials
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-30-2004, 04:41 AM
  4. tutorials on site
    By BuRtAiNiAn FlY in forum C++ Programming
    Replies: 19
    Last Post: 07-08-2002, 06:37 PM