Brainfuck interpreter.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
char program[] = ">>,[>>,]<<[[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]";
input [] ="dicekjhbagfl";
*i = input;
m[512] = {};
*p = m;
void b( char *c){
for(; *c && *c != ']'; ++c){
( *(( p += *c =='>' ) -= *c == '<') += *c =='+' ) -=*c=='-';
*c== '.' && cout << *p;
if(*c==',') *p=*i++;
if(*c=='['){
for(++c; *p; ) b(c);
for(int d=0; *c != ']' || d--; ++c) d+=*c=='[';
}
}
}
int main(){
b(program);
}