Hack Forums
[C#] Help me write this 30 bytes rewards - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Help me write this 30 bytes rewards (/showthread.php?tid=5929159)



Help me write this 30 bytes rewards - mestic - Jan 13, 2019

Hi guys, this might be one of the stupidest post you've seen but Im new to C# and need you help with this

"Write a program named GreenvilleMotto that displays the competition’s motto, which is “The stars shine in Greenville.” Edit the program so that it displays the motto surrounded by a border composed of asterisks."

Thanks lol
Will give 30 bytes for person who helps


RE: Help me write this - SIM-3364521 - Jan 13, 2019

string motto = "The starts shine in Greenville.";
StringBuilder display = new StringBuilder();

void printMotto(){
for(int i = 0; i < (motto.Length + 4); i++){
display.Append('*');
}
display.Append('\n* ');
display.Append(motto+" *\n");
for(int i = 0; i < (motto.Length + 4); i++){
display.Append('*');
}
display.Append('\n');
Console.Write(display.toString());
}

Something like that havent tested it.
But you should be able to figure it out from here.
If not feel free to pm me.

Edit: changed code slightly. Also you have to make sure to call the method from your main.


RE: Help me write this - mestic - Jan 13, 2019

(Jan 13, 2019 09:59 AM)Erarnitox Wrote:  string motto = "The starts shine in Greenville.";
StringBuilder display = new StringBuilder();

void printMotto(){
for(int i = 0; i < (motto.Length + 4); i++){
display.Append('*');
}
display.Append('\n* ');
display.Append(motto+" *\n");
for(int i = 0; i < (motto.Length + 4); i++){
display.Append('*');
}
display.Append('\n');
Console.Write(display.toString());
}

Something like that havent tested it.
But you should be able to figure it out from here.
If not feel free to pm me.

Edit: changed code slightly. Also you have to make sure to call the method from your main.
It gave me couple of error not sure which


RE: Help me write this 30 bytes rewards - gigajew - Jan 13, 2019

Challenge accepted
[Image: n2Imy2G.png]



RE: Help me write this 30 bytes rewards - mestic - Jan 13, 2019

(Jan 13, 2019 10:38 AM)gigajew Wrote:  Challenge accepted

Thank you! I sent you 35 Bytes!


RE: Help me write this 30 bytes rewards - SIM-3364521 - Jan 13, 2019

dude did you just paste this into a class and expect it to run just like that?
i just showed you how one could do it.
Didnt paste the whole class here so thats why you get errors.

-missing imports
-no class head
-no main


RE: Help me write this 30 bytes rewards - mestic - Jan 13, 2019

(Jan 13, 2019 02:22 PM)Erarnitox Wrote:  dude did you just paste this into a class and expect it to run just like that?
i just showed you how one could do it.
Didnt paste the whole class here so thats why you get errors.

-missing imports
-no class head
-no main

I already sent you 20 bytes