Noob - Hello World Not Working

This is a discussion on Noob - Hello World Not Working within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by abachler portable solution that works with every IDE Code: #include <iostream> #include <conio> using namespace std; int ...

  1. #16
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    478
    Quote Originally Posted by abachler View Post
    portable solution that works with every IDE

    Code:
    #include <iostream>
    #include <conio>
    using namespace std;
    
    int main (){
        cout << "Hello World!\n";
        cout << "Press any key to continue..."  
        getch();
        return 0;
        }
    How are you justifying a) including a whole separate header file for a single function and b) doing that for a function that has an equivalent defined in istream and all its derivatives(cin) and c) calling that portable?

    cin.get() does the trick for you, really.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  2. #17
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by IceDane View Post
    How are you justifying a) including a whole separate header file for a single function and b) doing that for a function that has an equivalent defined in istream and all its derivatives(cin) and c) calling that portable?

    cin.get() does the trick for you, really.

    because its hello world, not 'This has to pass a code review'.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  3. #18
    Registered User
    Join Date
    Sep 2009
    Posts
    12
    Quote Originally Posted by StainedBlue View Post
    ^never a good idea.
    Forgive me for being uninformed, but just why is it a bad idea?

    Dev-C++ automatically inserts
    Code:
      system("PAUSE");
        return EXIT_SUCCESS;
    -at the end of a source file if you choose to make a new console-based project. Does it make the code inefficient or something?

  4. #19
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,550
    It is non-portable. Only works in Windows, and it is vulnerable to certain attacks, I believe. Plus it has overhead.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Registered User
    Join Date
    Aug 2006
    Posts
    6
    Quote Originally Posted by Angie View Post
    Forgive me for being uninformed, but just why is it a bad idea?
    Things to Avoid in C/C++ -- system("pause")

    Also, Dev-C++ hasn't been updated in ~4 years. Try wxDev-C++, Code::Blocks, or Visual C++ Express 2008.

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

Similar Threads

  1. Too much to ask ?
    By deflamol in forum C Programming
    Replies: 2
    Last Post: 05-06-2004, 04:30 PM
  2. Hello World 180 KB???????
    By Musicdip in forum C++ Programming
    Replies: 17
    Last Post: 06-22-2002, 07:27 PM
  3. Who should rule the world?
    By CoderBob in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 02-07-2002, 06:01 AM
  4. Religious Bull****
    By Witch_King in forum A Brief History of Cprogramming.com
    Replies: 119
    Last Post: 10-23-2001, 07:14 AM
  5. No More Technology After World War Three
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-20-2001, 07:02 PM

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