Complete Beginner, HELP!!

This is a discussion on Complete Beginner, HELP!! within the C++ Programming forums, part of the General Programming Boards category; Hello everyone, I am a complete and utter beginner to programming, so I need some help. I have read "Tutorial ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    8

    Lightbulb Complete Beginner, HELP!!

    Hello everyone, I am a complete and utter beginner to programming, so I need some help. I have read "Tutorial 1" and that is even too complicated for me! I know it has nothing to do with programming but I know HTML and a bit of php editing..editing, nothing more. I picked html up pretty fast, and I am a fast learner! Please if you're experienced and can help me, reply!!

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    btw, I have Bloodshed Dev-C++ as recomended by a friend

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    What bits of it are you finding complicated?
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    OK...I don't understand what a compiler is, someones tried to explain but I don't understand him. I also don't understand what a preprocessor directive is, what it does, and what it is completely! When I go the file>new>source and copy the following...

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


    and I go to Execute>Complile & Run..it comes up with errors at the bottom of the window, stuff like

    31 C:\Dev-Cpp\include\c++\backward\iostream.h
    In file included from C:/Dev-Cpp/include/c++/backward/iostream.h


    and the program doesn't open. I also don't understand how to save the script as an executable to open outside of the C++ program. Pleas help!

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    ok..it works thanks..what does main() and void main() etc mean?

  6. #6
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    'void main()' is bad (just look at Salem's avatar). 'main' always returns an int.

    The 'main' function is the entry point to your program basically, and when it finishes, the program is over.

    A compiler is a program which takes written C++, and converts it into machine-readable object files. A link then comes along and links all your object files into a single executable.

    A preprocessor directive is a statement which gets executed before the compiler. Basically, anything with a # in front of it gets run through the preprocessor and evaluated (usually modifying the source code in some way), and then the compiler is executed.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  7. #7
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    To elaborate on what Zack L. said...

    A computer can't "run" C++. The computer runs machine language which is in the form of binary numbers (ones and zeros).

    Compilers allow us to write programs that are more "english-like". Besides being easier to write and understand, "high-Level" languages like C++ allow us to do things in one instruction that take many machine-language instructions. For example, not all microprocessors have a multiply function. So the machine-code has to multiply with a series of additions. The compiler will take care of this for you.

    Take a look a the size of hello.exe. You might be surprised how much bigger it is than your source code.

    Actually, the computer itself can't understand HTML either. HTML is inturpreted by your browser (which is running in machine language).

    Every platform has it's own machine language. You can't run a PC .exe program on a Mac.

    But, you can write a C++ program and re-compile it for various platforms (if you have a compiler for the "target" computer.)

    Don't get too confused by "Preprocessor Directives". These are just lines of code that are instructions to the compiler, rather than instructions to be turned into machine language by the compiler... Like speaking directly to a language translator, instead of through the translator to someone else.

    [IMHO] The first few lessons cover the stuff that really makes programming valuable and worthwhile... Loops and Decision Making/Branching (if statements). Once you understand looping and branching, you should have a feel for what programming is all about. There is a lot to C++ though, so don't expect to learn it all in a couple of weeks.

  8. #8
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Originally posted by britneyspy
    OK...I don't understand what a compiler is, someones tried to explain but I don't understand him. I also don't understand what a preprocessor directive is, what it does, and what it is completely! When I go the file>new>source and copy the following...

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


    and I go to Execute>Complile & Run..it comes up with errors at the bottom of the window, stuff like

    31 C:\Dev-Cpp\include\c++\backward\iostream.h
    In file included from C:/Dev-Cpp/include/c++/backward/iostream.h


    and the program doesn't open. I also don't understand how to save the script as an executable to open outside of the C++ program. Pleas help!
    > a compiler example is Bloodshed Dev-C++ - it turns your code into an .exe that can be run by a computer...
    >a preprocessor directive is something that tells the compiler what to do before it tries to compile teh program into an .exe, for exapmle, anything preceded by a '#' or '##' (#include, #define, etc.)
    >the number before the error is the line (or around the line) the error is on. the path after that is where the error was found, and after that is the explanation of the error
    >int main() is the main function that the .exe runs first. everything is controlled from here
    >cout is an output statement - it prints stuff to the screen
    >return is what the function will return when called - you'll learn more about this when you go into value-returning functions. int main() will also become clearer when you go over this...

    if you're having trouble in a certain area, i found it best to go on for a little while... most of the time it will be cleared up, but if it doesn't ask for help... ;-)
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  9. #9
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    ok thats great...any more tips or explanations?

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    ok..now when i try to compile and run it has errors all over the place! i left the iostream.h there and it had errors, then i just has ionstream without the .h and it opens the compiler file and puts the "hello world" in maroon highlighting..this is not easy!

  11. #11
    Registered User
    Join Date
    Jun 2003
    Posts
    7
    hey, I use Dev C++ too, but I've learned it still compiles even with the errors, (I dont know if it compiles properly as cin>> isn't displaying the C:\> option inorder to enter something) Anyways, your program will still run, the errors arent in the program, just your compiler telling you/recommending you to use the new C++ format.

  12. #12
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Originally posted by britneyspy
    ok..now when i try to compile and run it has errors all over the place! i left the iostream.h there and it had errors, then i just has ionstream without the .h and it opens the compiler file and puts the "hello world" in maroon highlighting..this is not easy!
    did you put in "using namespace std;" under the "#include <iostream>"?

    post your code... it's hard to tell where you are without seeing how far you've gone...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  13. #13
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Originally posted by XcomvB
    hey, I use Dev C++ too, but I've learned it still compiles even with the errors, (I dont know if it compiles properly as cin>> isn't displaying the C:\> option inorder to enter something) Anyways, your program will still run, the errors arent in the program, just your compiler telling you/recommending you to use the new C++ format.
    If the compiler generates errors, it won't continue to compile. If it generates warnings though, then it will compile, but you should pay attention to the warnings, even though it'll compile. And cin isn't supposed to print "C:\", thats just part of the Windows shell.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  14. #14
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    "OK...I don't understand what a compiler is"

    You're a beginner so what does it matter? All you need to know is that it's software necessary to run your program.

    "ok..it works thanks..what does main() and void main() etc mean?"

    Once again, what does it matter? At this point, just use this format for every program:
    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
        ....
        ....
        ....
        return 0;
    }

  15. #15
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    ok, this is the code i have used now..
    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    cout<<"HEY, you, I'm alive! Oh, and Hello World!";
    return 0; 
    }
    but now when it compiles a DOS window opens for less than a second and then closes again?! is this normal?
    Also, now i use the using namespace std; underneath the <iostream> does it mean I have to use this in EVERY script, does it ever change etc?

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 12:48 PM
  2. Help out a complete beginner
    By Jmcrofts in forum C++ Programming
    Replies: 7
    Last Post: 07-28-2007, 01:09 PM
  3. Complete Beginner [Need Help]
    By Vintik in forum C++ Programming
    Replies: 10
    Last Post: 08-15-2005, 06:08 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM
  5. doom lord engine complete!
    By Leeman_s in forum C++ Programming
    Replies: 4
    Last Post: 04-25-2002, 09:41 PM

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