+ Reply to Thread
Results 1 to 10 of 18
-
26th April 2012, 05:39 PM #1Notebook Enthusiast
- Join Date
- Jun 2010
- Posts
- 37
- Rep Power
- 8
Most Creative way to write a String!
Last week a bonus question for one of my programming assignments was to print out "String" in the most creative/difficult/interesting way you can think of.
Example: printf("String\n");
Of course be more creative.
I thought this might be an interesting topic for NBR. What are your ideas?!
-
26th April 2012, 06:43 PM #2
Re: Most Creative way to write a String!
Do it in Assembly...
Now you could create a string of letters in hex to create the word "String" and then output that. But I'm too lazy to do that at the moment...Code:section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'String',0xa ;our dear string len equ $ - msg ;length of our dear string
Last edited by HTWingNut; 26th April 2012 at 06:55 PM.

Sager NP9150 'Prometheus': 15.6" 1080p matte - i7-3740QM - GTX 680m - 16GB 1600 - 512GB+mSATA 256GB Crucial M4 - Blu-Ray
Sager NP6110 'Firefly': 11.6" 768p matte - i7-3610QM - GT 650m - 8GB 1600 - 500GB Samsung 840
Sager Reviews: UPDATED 5/9/13 NP6110 w/650m i5 vs i7 | NP9570 w/680m SLI | NP9370 w/ 680m SLI | NP9150 w/680m | PREMA'S CLEVO BIOS | MOD 680m vBIOS
My WHS 2011 | HP 6475b A10-4600m | All my other crap
-
26th April 2012, 07:10 PM #3
Re: Most Creative way to write a String!
Lol. Nice HTWingNut. As soon as I read the OP, I also thought of Assembly. I'm a little bias towards it since I use it at work everyday for a couple of hours
M18x.R2
AMD 7970M CrossFireX™
Intel® Core™ i7-3720QM
128GB M4 SSD, 2TB HDD
-
26th April 2012, 07:17 PM #4NBR Resident Redneck.
- Join Date
- May 2006
- Location
- Deer stand back in the pines.
- Posts
- 5,003
- Rep Power
- 39
Re: Most Creative way to write a String!
Code:int arr[6]; int count; char input; for (count=0; count<6; count++) { cin >> input; arr[count]=input; } for (count=0; count<6; count++) { cout << arr[count]; }
Main rig: Dell precision m4600 - 2860QM, firepro 5950, 16GB 1600mhz RAM 9-9-9-28, WLED FDH+, Intel 520 240GB mSata OS, Seagate hybrid 750GB storage.
Home Web/FTP/SSH Server: Dell precision m4400 Debian squeeze
-
26th April 2012, 08:22 PM #5Banned
- Join Date
- Feb 2007
- Posts
- 5,375
- Rep Power
- 0
Re: Most Creative way to write a String!
Why htwingnut, you know assembly? I is impressed.
-
26th April 2012, 08:29 PM #6
Re: Most Creative way to write a String!
I know lots of languages... just nothing more than "Hello World!" lol.

Sager NP9150 'Prometheus': 15.6" 1080p matte - i7-3740QM - GTX 680m - 16GB 1600 - 512GB+mSATA 256GB Crucial M4 - Blu-Ray
Sager NP6110 'Firefly': 11.6" 768p matte - i7-3610QM - GT 650m - 8GB 1600 - 500GB Samsung 840
Sager Reviews: UPDATED 5/9/13 NP6110 w/650m i5 vs i7 | NP9570 w/680m SLI | NP9370 w/ 680m SLI | NP9150 w/680m | PREMA'S CLEVO BIOS | MOD 680m vBIOS
My WHS 2011 | HP 6475b A10-4600m | All my other crap
-
26th April 2012, 08:40 PM #7Banned
- Join Date
- Feb 2007
- Posts
- 5,375
- Rep Power
- 0
Re: Most Creative way to write a String!
I can say hello world in 5 languages. I guess that makes me a real hacker!
-
26th April 2012, 10:50 PM #8
Re: Most Creative way to write a String!
Here's my attempt, using Java:
char[] theString = "String".toCharArray();
for (int i = 0; i < theString.length; i++)
{
System.out.print(theString[i]);}
System.out.println();
HP Compaq nw8440 | Core Duo T2600 2.16GHz | 4GB 667MHz DDR2 RAM | 500GB 7200rpm HD
| DVD±RW DL drive w/ LightScribe | ATi FireGL V5200 256MB GFX | 15.4" 1920x1200 LCD
| Broadcom a/b/g + Bluetooth | XP Pro w/SP3 + Ubuntu Linux 12.04 (dual boot)
Sony VAIO VGN-TX770P | Pentium M ULV 1.3GHz | 1.5GB RAM | 80GB 4200RPM HD
| DVD±RW DL drive | Intel Integrated GFX | 11.1" 1366x768 LCD | Intel b/g + Bluetooth
| XP Pro w/SP3
flickr
-
26th April 2012, 11:39 PM #9
-
27th April 2012, 01:49 AM #10Notebook Enthusiast
- Join Date
- Jun 2010
- Posts
- 37
- Rep Power
- 8



LinkBack URL




Reply With Quote


I`m upgrading, are you? (GTX 780M...
Yesterday, 11:56 PM in Gaming (Software and Graphics Cards)