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-01 11:36

ABC has nine commands, people, not three.

public class ABCInterpreter {
    public static void main (String[] args) {
        for (int i = 0; i < args.length; i++) {
            boolean ascii = false;
            int BUFFA = 0;

            for (int j = 0; j < args[i].length(); j++) {
                switch (args[i].charAt(j)) {
                    case 'a':
                        BUFFA++;
                        break;
                    case 'b':
                        BUFFA--;
                        break;
                    case 'c':
                        System.out.print(ascii ? (char) BUFFA
                                               : BUFFA);
                        break;
                    case 'd':
                        System.err.println("I have no idea what 'invert' means");
                        break;
                    case 'r':
                        BUFFA = new java.util.Random().nextInt(BUFFA);
                        break;
                    case 'n':
                        BUFFA = 0;
                        break;
                    case '$':
                        ascii = !ascii;
                        break;
                    case 'l':
                        i = 0;
                        break;
                    case ';':
                        System.out.println("\n" + (char) BUFFA
                                           + " " + BUFFA);
                        break;
                    default:
                        System.err.println("Unknown command: " +
                                           args[i].charAt(j));
                }
            }
        }
        System.out.println("");
    }
}

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