Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

[SOLVED] Help With Hello World

hello world

  • This topic is locked This topic is locked
9 replies to this topic

#1 aliraza99

aliraza99

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts
  • Programming Language:C, Java, C++, Objective-C, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Ruby, PL/SQL
  • Learning:C, Java, C++, Objective-C, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Ruby, PL/SQL, Visual Basic .NET

Posted 31 July 2012 - 03:11 AM

hey guys i m new to this forum...... i m facing a problem when i run a simple programe of C++ ""HELLO WORLD""
the result window. plz HLEP...
  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 31 July 2012 - 07:25 AM

What is your code? What exactly is the issue?
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#3 Hacker4life

Hacker4life

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 77 posts
  • Location:Serbia
  • Programming Language:C, C++, Delphi/Object Pascal, Pascal, Others
  • Learning:C, Java, C++, (Visual) Basic, Python, Delphi/Object Pascal, Pascal, Assembly, Others

Posted 08 August 2012 - 02:28 AM

printf("Hello world");
?
  • 0

#4 CodeTiger

CodeTiger

    CC Regular

  • Member
  • PipPipPip
  • 25 posts
  • Programming Language:Java, C++, C#, JavaScript, Lua
  • Learning:Objective-C

Posted 15 August 2012 - 06:21 AM

or std::cout << "Hello world" << std::endl; ?
  • 0

#5 Zer033x

Zer033x

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 50 posts
  • Programming Language:C++, C#, Lua
  • Learning:C++, C#, JavaScript, Lua, Others

Posted 16 August 2012 - 08:39 PM

Lemme guess, the window pops up then disappears too quickly to see. You could add std::cin >> x; to just let it stay open expecting input, run without debugging if using visual studio, or set a break point and run it, and various other ways.
  • 0

#6 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 20 August 2012 - 11:13 AM

Or run it from the terminal.
  • 0

sudo rm -rf / && echo $'Sanitize your inputs!'


#7 Shasaur

Shasaur

    CC Lurker

  • New Member
  • Pip
  • 7 posts
  • Programming Language:C++, JavaScript, Visual Basic .NET, ActionScript
  • Learning:C++, Others

Posted 22 August 2012 - 07:57 AM

Why are using
printf("HELLO WORLD");
that is a code for the language C not C++

In C++ you would do it like this:
cout<<"HELLO WORLD";

  • 0

#8 neil

neil

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 373 posts
  • Location:Philadelphia
  • Programming Language:C++, Perl, Bash
  • Learning:C, Java, C++, Python, JavaScript, Perl, Bash, Others

Posted 22 August 2012 - 09:31 AM

Why are using
that is a code for the language C not C++
In C++ you would do it like this:

Why can't you use it in c++ ?

[neil@crunchbang ~/chceck/cb]$ vi printf.cpp
[neil@crunchbang ~/chceck/cb]$ g++ -o a.out printf.cpp
[neil@crunchbang ~/chceck/cb]$ ./a.out
Are you sure we can't use it in c++?
[neil@crunchbang ~/chceck/cb]$


here's the code
#include <stdio.h>

int main()
{
printf ("Are you sure we can't use it in c++?\n");
return 0;
}

C++ is an extension of C. Do not forget that.
  • 0

#9 lintwurm

lintwurm

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 261 posts
  • Programming Language:C, Java, C++, C#, PHP, (Visual) Basic, Python, Visual Basic .NET

Posted 30 August 2012 - 05:36 AM

Just to put some fuel on the fire, the reason to use printf instead of cout is that printf is actually faster. Not by much, but it is.

Plus I'm guessing this thread is solved... Anyone feel like closing it?
  • 0
No harm was done to the world in sending this message, but a few million electrons have been SERIOUSLY inconvenienced...

#10 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 30 August 2012 - 12:38 PM

This topic has been marked as SOLVED. If you have a similar question or topic, you can go back to the subforum and start a new topic to continue discussions.
  • 0

sudo rm -rf / && echo $'Sanitize your inputs!'






Also tagged with one or more of these keywords: hello world

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download