Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- struct float_tuple
- {
- float x;
- float y;
- };
- static int test1 (int a, int b, int c, int x);
- static int test2 (int a, int b, int c, int x);
- static struct float_tuple* test3 (float a, float b, float c);
- static int test4 (float a, float b, float c);
- static int test5 (int a, int b);
- static int test6 (int a, int b);
- static int test7 (int a, int b, int c);
- static int test8 (int a, int b, int c);
- static int test9 (char a);
- static int test10 (char a);
- static int test11 (char a);
- static char test12 (char a);
- int main (int argc, char* argv[])
- {
- int a,b,c,x;
- char d,e;
- int quad, quadisZero, realRoots, bigger, smaller, biggestOf3, smallestOf3;
- int isADigit, isAlphabetic, digitCharToInt;
- char lowerToUpper;
- struct float_tuple* quadratic_solver;
- sscanf(argv[0],"%d",&a);
- sscanf(argv[1],"%d",&b);
- sscanf(argv[2],"%d",&c);
- sscanf(argv[3],"%d",&x);
- sscanf(argv[4],"%c",&d);
- sscanf(argv[5],"%c",&e);
- quad = test1(a, b, c, x);
- quadisZero = test2(a, b, c, x);
- quadratic_solver = test3((float)a, (float)b, (float)c);
- realRoots = test4((float)a, (float)b, (float)c);
- bigger = test5(a, b);
- smaller = test6(a, b);
- biggestOf3 = test7(a, b, c);
- smallestOf3 = test8(a, b, c);
- isADigit = test9(d);
- isAlphabetic = test10(d);
- digitCharToInt = test11(d);
- lowerToUpper = test12(e);
- }
- static int test1 (int a, int b, int c, int x) { return ((a * x * x) + (b * x) + c); }
- static int test2 (int a, int b, int c, int x) { return !test1(a,b,c,x); }
- static struct float_tuple* test3 (float a, float b, float c)
- {
- struct float_tuple* value = (struct float_tuple*)malloc(sizeof(struct float_tuple));
- float root = sqrt((b*b) - 4 * a * c);
- value->x = ((-b + root)/(2 * a));
- value->y = ((-b - root)/(2 * a));
- return value;
- }
- static int test4 (float a, float b, float c)
- {
- return (((b*b) - 4 * a * c) >= 0.0);
- }
- static int test5 (int a, int b) { return ((a > b) ? a : b); }
- static int test6 (int a, int b) { return ((a < b) ? a : b); }
- static int test7 (int a, int b, int c) { return test5(test5(a,b),c); }
- static int test8 (int a, int b, int c) { return test6(test6(a,b),c); }
- static int test9 (char a) { return ((((int)'0') <= (int)a) && ((int)a <= (int)'9')); }
- static int test10 (char a) { return ((((int)'a') <= (int)a) && ((int)a <= (int)'Z')); }
- static int test11 (char a) { return (test9(a) ? atoi(&a) : 0); }
- static char test12 (char a) { return (((((int)'a') <= (int)a) && ((int)a <= (int)'z')) ? ((char)(26 + (int)a)) : 'A'); }
Add Comment
Please, Sign In to add comment