Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ITT the ABC Programming Language

Name: Anonymous 2008-07-29 19:29

#include <stdio.h>

int main(int argc,char argv*[]){
  int i = 0;
  int BUFFA;

  while(argv[i]!='\0'){
    if(argv[i]='a')
      BUFFA++;
    else if(argv[i]='b')
      BUFFA--;
    else if(argv[i]='c')
      printf("%i\n",BUFFA);
    else printf("%s","Error.\n");
  }
}

Name: Anonymous 2008-08-04 11:54

if you missed the PHP reference implementation here it is:
<?php
if (substr(php_sapi_name(), 0, 3) != 'cli') show_source(__FILE__) xor die();
$prog=file_get_contents("php://stdin");
$ascii=false;
$acc=0;
for($i=0;$i<strlen($prog);$i++) {
  $c=$prog[$i];
  switch($c) {
    case 'a': $acc++; break;
    case 'b': $acc--; break;
    case 'c': if($ascii) echo chr($acc); else echo $acc; break;
    case 'd': $acc*=-1; break;
    case 'r': $acc=mt_rand(0,$acc); break;
    case 'n': $acc=0; break;
    case '$': $ascii=!$ascii; break;
    case 'l': $i=-1; break;
    case ';': echo $acc.chr($acc); break;
  }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List