Character printing program not behaving properly

73 Views Asked by At

I have been making a program that outputs each character before a given one to the screen, but... I've been doing it with Brainfuck! :)

I would like to be able to input a character, and see all the characters that come before it. The code I have so far only outputs a space and then waits for the next key press before exiting.

++++++++
[>+++++++++<-]>.>++++++++++[>++++++++++<-]>+.+++++++..+++.>
++++++++[>++++<-]>.>++++++++[>++++++++++++<-]>+.+++ ++++++++++.
----------.>++++++++[>++++<-]>.>++++++++++
[>++++++++<-]>+++++++.
++++++++++++++.>+++++++++[>++++++++++++<-]>.---------.>
++++++++++[>+++++++++++<-]>+.--.--------.>+++
[>++++++++++<-]>+++.>++++++++++
..>+[,[>+>+<<-][>>-<<+>>]>[[-.]<]],

I've tried for ages to figure out what's wrong with this code, but everything I've done has messed it up.

1

There are 1 best solutions below

0
On

Works for me, try this BF interpreter

------[>++++++++++<+]>--.+<------[>---<+]>.