17
\$\begingroup\$

Create a program which when run displays the text below:

)-*-*-*^_^*-*-*-(
| Welcome User! |
)-*-*-*^_^*-*-*-(

Use any functions or language to answer this, have fun. Shortest code wins

\$\endgroup\$
  • 3
    \$\begingroup\$ Can we alternatively return this from a function, as per usual? \$\endgroup\$ – Stephen Jun 20 '17 at 20:00
  • 6
    \$\begingroup\$ Are leading/trailing newlines allowed? \$\endgroup\$ – Gryphon Jun 20 '17 at 20:08

51 Answers 51

1
2
2
\$\begingroup\$

Minecraft, 107 bytes

/tellraw @p ["",{"text":")-*-*-*^_^*-*-*-(\n"},{"text":"| Welcome User! |\n"},{"text":")-*-*-*^_^*-*-*-("}]
| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

C, 65 66 bytes

main(){printf("%s| Welcome User! |\n%1$s",")-*-*-*^_^*-*-*-(\n");}

Yes, there are other C solutions, also coming in at about 66 bytes.

Ungolfed

main()
{
    printf("%s| Welcome User! |\n%1$s",
          ")-*-*-*^_^*-*-*-(\n"
          );
}

GCC produces a warning for the missing printf prototype.

The %1$s says use argument 1 (again) for the second string argument.

In real-life programs, it can also be used to pass in precision/width arguments into a printf. This avoids having to use a printf to create the format string for the real printf.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Which compiler successfully compiles and runs this? My gcc (7.1.1) gives an error for the missing semicolon and fails to compile. \$\endgroup\$ – Doorknob Jun 22 '17 at 2:42
  • \$\begingroup\$ csm@localhost:~$ gcc --version gcc (Debian 4.9.2-10) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \$\endgroup\$ – CSM Jun 22 '17 at 20:45
  • \$\begingroup\$ I tried compiling gcc 4.9.2 from source on my machine, but I still got an error rather than a warning for the missing semicolon. Is there any other way to reproduce this? \$\endgroup\$ – Doorknob Jun 22 '17 at 23:53
  • \$\begingroup\$ Argh. You are right, the semicolon is needed. I was accidentally running the previous compilation result. \$\endgroup\$ – CSM Jun 23 '17 at 12:33
2
\$\begingroup\$

PowerShell, 47 bytes

($z=')-*-*-*^_^*-*-*-(')
"| Welcome User! |
$z"

Try it online!

Ran into the problem everyone else is running into: there's not enough meat to justify trying to encode the top line's pattern. A fancier join method also turned out to cost one more byte

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Retina, 42 bytes


A¶| Welcome User! |¶A
A
)-*-*-*^_^*-*-*-(

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

SOGL V0.12, 27 bytes

↑αMΟ±.○h+‘╬1"→ū↑, ¶‘θ⁾@∑32ž

Try it Here!
I have no idea why I still haven't added a capitalize 1st letter of each word function... Here it uses a 4-byte replacement

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Braingolf, 48 bytes

")-*-*-*^_^*-*-*-("!&@"
| Welcome User! |
"@19&@

Try it online!

Explanation

")-*-*-*^_^*-*-*-("        push the string ")-*-*-*^_^*-*-*-(" as characters
                   !&@     print all the characters on the stack without popping
                      "
| Welcome User! |          push the string "\n| Welcome User! |\n"
"
 @19                       pop and print 19 characters on the stack
    &@                     print all the characters on the stack
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Kotlin, 88 bytes

fun main(a:Array<String>){val s=")-*-*-*^_^*-*-*-(";print("$s\n| Welcome User! |\n$s")}"
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

PHP, 56 52 bytes

<?=$s=")-*-*-*^_^*-*-*-(\n","| Welcome User! |\n$s";
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ ;echo ──→ , \$\endgroup\$ – manatwork Jun 21 '17 at 12:03
  • \$\begingroup\$ @manatwork Thanks. I guess you always learn something new every day. \$\endgroup\$ – Sainan Jun 22 '17 at 10:27
1
\$\begingroup\$

TCL, 73 bytes 54 bytes

set a )-*-*-*^_^*-*-*-( set b "| Welcome User! |" puts " $a\n $b\n $a"


puts "[set a )-*-*-*^_^*-*-*-(]
| Welcome User! |
$a"

Thanks @sergiol for the suggestion!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Stax, 25 bytes

æu√hy╘£.ÅJnc¡┐ßD.P☻Θ╖>╘rÇ

Run and debug it

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Wren, 64 bytes

Fn.new{"1| Welcome User! |
1".replace("1",")-*-*-*^_^*-*-*-(
")}

Try it online!

Explanation

Fn.new{                           // New anonymous function
       "1| Welcome User! |
1"                                // Create the string "| Welcome User! |"
  .replace("1",")-*-*-*^_^*-*-*-(
")}                               // Prepend & append the string ")-*-*-*^_^*-*-*-(\n"
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

C (gcc), 63 bytes

f(){printf("%s| Welcome User! |\n%1$s",")-*-*-*^_^*-*-*-(\n");}

Try it online!

Three bytes shorter than all the previous solutions because new rules allow functions.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

PHP, 55 bytes

$a=')-*-*-*^_^*-*-*-(';
echo <<<S
$a
| Welcome User! |
$a
S;
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Welcome to PPCG! \$\endgroup\$ – Laikoni Jun 21 '17 at 21:31
0
\$\begingroup\$

><>, 76 61 bytes

!v"(-*-*-*^_"~! |
 >~")"a"| !resU emocleW |v"61pa10.
l?!;o >
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

VBA, 48 Bytes

Anonymous VBE immediate window function that takes no input and outputs a greeting to the user via the immediate window

a=")-*-*-*^_^*-*-*-(":?a:?"| Welcome User! |":?a
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I post mine then deleted immediately when I saw yours. :D \$\endgroup\$ – remoel Oct 20 '17 at 10:13
0
\$\begingroup\$

Golang, 67 Bytes

func n(){a:=")-*-*-*^_^*-*-*-(\n";Print(a+"| Welcome User! |\n"+a)}

Prints with a trailing newline.

Try it online!

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Canvas, 29 bytes

-*3×^_+)×│| Welcome User! |┌)

Try it here!

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

JavaScript (Node.js), 58 bytes

(u=')-*-*-*^_^*-*-*-(')=>[u,'| Welcome User! |',u].join`
`

Try it online!

I am sure I can golf if down , but later

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Runic Enchantments, 46 bytes

>")-*-*-*^_^*-*-*-(":$ak"| Welcome User! |"ak@

Try it online!

It will appear to process until it times out, due to the two ^ commands which spawn IPs that do nothing (necessitating the explicit entry >). I am disapointed that this is 2 bytes shorter than the multiple IP method. Constructing the first and last lines using multiplication/duplication turns out to be even more expensive as well (50 bytes). :(

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

R, 61 bytes

r=")-*-*-*^_^*-*-*-(\n";cat(r,"| Welcome User! |\n",r,sep="")

Try it online!

Has a trailing newline. I couldn't see if that was approved or not, so I just rolled with it.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

PowerShell, 54 bytes

$a=')-*-*-*^_^*-*-*-(';write $a;"| Welcome User! |";$a

Try it online!

Old - 68 bytes

Write-Host ")-*-*-*^_^*-*-*-(`n| Welcome User! |`n)-*-*-*^_^*-*-*-("
| improve this answer | |
\$\endgroup\$
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.