how to print the hello

Discussion in 'C++' started by sudhir, Mar 9, 2006.

  1. sudhir

    sudhir Guest

    The c++ program is:

    #include<iostream.h>
    void main(void ) {;}

    Now without affecting the above two lines if I want to print the
    "hello", how to do that..Please provide me the solution

    sudhir
     
    sudhir, Mar 9, 2006
    #1
    1. Advertising

  2. sudhir

    Rolf Magnus Guest

    sudhir wrote:

    > The c++ program is:
    >
    > #include<iostream.h>
    > void main(void ) {;}


    That's not a C++ program.

    > Now without affecting the above two lines if I want to print the
    > "hello", how to do that..Please provide me the solution


    Maybe you should do your homework yourself?
     
    Rolf Magnus, Mar 9, 2006
    #2
    1. Advertising

  3. sudhir

    Ben Pope Guest

    sudhir wrote:
    > The c++ program is:
    >
    > #include<iostream.h>


    // this header is not standards compliant, so it cannot be done in C++

    > void main(void ) {;}


    // main returns an int, always, so this is not standard C++

    > Now without affecting the above two lines if I want to print the
    > "hello", how to do that..Please provide me the solution


    I guess that's pretty implementation defined. Neither of the above two
    lines are actually C++, so it is not topical here.

    It's also been asked more than once in the last month, so search the
    archives with groups.google.com

    Ben Pope
    --
    I'm not just a number. To many, I'm known as a string...
     
    Ben Pope, Mar 9, 2006
    #3
  4. sudhir

    benben Guest

    /*
    > #include<iostream.h>
    > void main(void ) {;}

    */

    #include <iostream>
    int main(){std::cout << "hello";}
     
    benben, Mar 9, 2006
    #4
  5. sudhir

    Tomás Guest

    sudhir posted:

    > The c++ program is:
    >
    > #include<iostream.h>
    > void main(void ) {;}
    >
    > Now without affecting the above two lines if I want to print the
    > "hello", how to do that..Please provide me the solution
    >
    > sudhir
    >


    If a C++ teacher or lecturer gave you that code, tell them I said he or
    she is incompetent.

    Here's how to print "Hello":

    #include <iostream>
    using std::cout;

    int main()
    {
    cout << "Hello";
    }
     
    Tomás, Mar 9, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carl
    Replies:
    4
    Views:
    438
    Peter Hansen
    May 21, 2004
  2. Daniel Crespo
    Replies:
    5
    Views:
    428
    Amaury
    Nov 13, 2005
  3. vijay
    Replies:
    8
    Views:
    751
  4. Replies:
    10
    Views:
    647
  5. Roy
    Replies:
    6
    Views:
    695
    Roedy Green
    Jan 7, 2008
Loading...

Share This Page