Hello World!

(previously 'DEVELOPER') Private forum for registered community members. To register, please visit www.prison-architect.com/register.

Moderator: NBJeff

AgentPaper
level2
level2
Posts: 124
Joined: Fri May 17, 2013 2:04 am

Postby AgentPaper » Thu Jun 13, 2013 8:06 pm

#include <iostream>

int main ()
{
std::cout << "Hello World!";
return 0;
}
ray4ever
level1
level1
Posts: 13
Joined: Sun May 05, 2013 6:46 am

Postby ray4ever » Thu Jun 13, 2013 9:13 pm

print 'Hello World!'
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Thu Jun 13, 2013 9:37 pm

Great Magical Hat wrote:
xander wrote:

Code: Select all

printf();


In other words, you've got nothing to say? ;)

indeed.

xander
User avatar
paktsardines
level5
level5
Posts: 1752
Joined: Mon Oct 01, 2012 11:10 am
Location: Australia

Postby paktsardines » Fri Jun 14, 2013 2:44 am

Code: Select all

#!/bin/env perl

my @letters = (' ', 'd', 'e', 'h', 'l', 'o', 'r', 'w');
do {
        $text = rndStr($#letters, @letters);
        $revtext = reverse($text);
} while ($revtext ne 'dlrow olleh');

print $text . "!";

sub rndStr{ join'', @_[ map{ rand @_ } 1 .. shift ] }


The O(n!) solution...
DHKold
level1
level1
Posts: 60
Joined: Mon Oct 08, 2012 9:29 am

Postby DHKold » Fri Jun 14, 2013 8:55 am

Great Magical Hat wrote:
DHKold wrote:
asmo0 wrote:std::cout << "Hello" << std::endl;


better :)


Erm, no?

To be more precise: no, using "\n" is equally platform independent, if that's what you're thinking. std::endl actually has a side effect that may cause performance problems (flushing the buffer) so only in the rare case you care about the buffer std::endl might be better, otherwise "\n" is never worse and often better.

Well, since we're on a forum, I assumed he would like his message to be flushed directly.

And honestly, if we care about performances, I don't think the display would be the first thing to look at :)
asmo0
level2
level2
Posts: 112
Joined: Sat Apr 27, 2013 4:53 pm

Postby asmo0 » Fri Jun 14, 2013 9:58 am

well fuck me for trying to keep it simple...

Code: Select all

.data
   str   db   'Hello\n'
.code
   _start:
      movl   6,%edx
      movl   db,%ecx
      movl   1,%ebx
      movl   4,%eax
      int      0x80
      movl   0,%ebx
      movl   1,%eax
      int      0x80


ps: havent done assembly in years, Im probably missing something and I had to look up config for sys-write interrupt... And this is totally not intentionally feeding the fire
edit: and yes, I know it still doesn't flush.
asmo0
level2
level2
Posts: 112
Joined: Sat Apr 27, 2013 4:53 pm

Postby asmo0 » Fri Jun 14, 2013 10:03 am

Great Magical Hat wrote:
DHKold wrote:
asmo0 wrote:std::out << "Hello" << std::endl;


better :)


Erm, no?

To be more precise: no, using "\n" is equally platform independent, if that's what you're thinking. std::endl actually has a side effect that may cause performance problems (flushing the buffer) so only in the rare case you care about the buffer std::endl might be better, otherwise "\n" is never worse and often better.
Not to mention the practical aspect of performing two separate write-calls, occasionally causing really weird printouts in parallel programs.
Great Magical Hat
level3
level3
Posts: 486
Joined: Thu Dec 15, 2005 4:57 pm
Location: Netherlands

Postby Great Magical Hat » Fri Jun 14, 2013 2:46 pm

DHKold wrote:Well, since we're on a forum, I assumed he would like his message to be flushed directly.

And honestly, if we care about performances, I don't think the display would be the first thing to look at :)


That's why I wouldn't have opposed to you posting an std::endl solution, but I do oppose to you trying to correct someone by posting an std::endl solution.
DMT
level0
Posts: 7
Joined: Wed Jun 12, 2013 12:49 pm

Postby DMT » Fri Jun 14, 2013 5:20 pm

World!!! Nice to meet you!!!

_>>&funtion mcnuggets
($^& might.end
User avatar
111none
level4
level4
Posts: 970
Joined: Fri Oct 19, 2012 3:32 am
Location: Wangjing, Beijing, Peoples Republic of China

Postby 111none » Sat Jun 15, 2013 6:00 am

I chose you! Pikachu!
With the sincerest regards,
111none

Return to “Community Members”

Who is online

Users browsing this forum: No registered users and 4 guests