locked
Hello World RRS feed

  • Question

  • I am working on the hello world console application however the screen flashes the hello world text and closes. Is there a simple statement I can use that will pause the screen awaiting my input?

    The video tutorial uses pointers and a char array which is a little too complicated for me. I am a new biginner.

     

    Thanks

    Dante

     

    Sunday, December 5, 2010 3:13 PM

Answers

  • C or C++

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        printf("Hello World!\n");
        system("pause");
        return 0;
    }

    C++ only

    #include <iostream>
    #include <cstdlib>
    using namespace std;

    int main()
    {
        cout << "Hello World!\n";
        system("pause");
        return 0;
    }

    - Wayne
    • Marked as answer by Dante Miles Sunday, December 5, 2010 4:22 PM
    Sunday, December 5, 2010 4:08 PM
  • Works great thanks Wayne!
    • Marked as answer by Dante Miles Sunday, December 5, 2010 4:23 PM
    Sunday, December 5, 2010 4:23 PM

All replies

  • C or C++

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        printf("Hello World!\n");
        system("pause");
        return 0;
    }

    C++ only

    #include <iostream>
    #include <cstdlib>
    using namespace std;

    int main()
    {
        cout << "Hello World!\n";
        system("pause");
        return 0;
    }

    - Wayne
    • Marked as answer by Dante Miles Sunday, December 5, 2010 4:22 PM
    Sunday, December 5, 2010 4:08 PM
  • Works great thanks Wayne!
    • Marked as answer by Dante Miles Sunday, December 5, 2010 4:23 PM
    Sunday, December 5, 2010 4:23 PM