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 13:38
#include "stdafx.h"
#include "iostream"
#include <string>
#include "stdlib.h"
#include "time.h"
int _tmain(int argc, _TCHAR* argv[])
{
int buffer = 0;
bool ascii = false;
std::string input ="";
std::cout << "Please enter ABC String: ";
std::cin >> input;
std::string::iterator theIterator;
theIterator = input.begin();
srand( (unsigned) time(NULL) );
while(theIterator != input.end()){
if(*theIterator == 'a')
buffer++;
else if(*theIterator == 'b')
buffer--;
else if(*theIterator == 'c'){
if(ascii)
std::cout << (char)buffer << std::endl;
else
std::cout << buffer << std::endl;}
else if(*theIterator == 'd')
buffer=-1*buffer;//Or whatever it means.
else if(*theIterator == 'r'){
buffer = 0 + (rand() % (buffer+1));}
else if(*theIterator == 'n')
buffer=0;
else if(*theIterator == 'l')
theIterator = input.begin();
else if(*theIterator == '$'){
if (ascii)
ascii=false;
else
ascii=true;}
else if(*theIterator == ';'){
std::cout << (char)buffer << std::endl;
std::cout << buffer << std::endl;}
else
std::cout << "Error.\n";
if(*theIterator != 'l')
theIterator++;
}
return 0;
}
Newer Posts