#include
#include
int main(int argc, char *argv[]){
int i;
printf("((((");
for(i=1;i!=argc;i++){
if( strcmp(argv[i], "^")==0) printf(")^(");
else if(strcmp(argv[i], "*")==0) printf("))*((");
else if(strcmp(argv[i], "/")==0) printf("))/((");
else if(strcmp(argv[i], "+")==0) printf(")))+(((");
else if(strcmp(argv[i], "-")==0) printf(")))-(((");
else printf("%s", argv[i]);
}
printf("))))\n");
return 0;
}
Monday, September 10, 2007
Operator Parsing: Nice Hack
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment