Code:
#include <stdio.h>
int add (int A, int S);
int dif (int D, int F);
int mult (int Q, int W);
int div (int E, int R);
int main()
{
int A,S,D,F,Q,W,E,R;
int sheep=1,skin=2,seat=3,covers=4;
int dumbass;
/* I know I have weird variable names that don't pertain, at all, to their function.
That was kind of the point. If you have to look at my crappy code, you may as well have a reason to smile about it.
Does that compute? */
printf( "This is Hiru's crappy calculator.\nPlease choose which crappy operation you would like to perform:\n" );
printf( "(1) Addition; (2) Subtraction; (3) Multiplication; (4) Division: " );
scanf( "%d", &dumbass );
if (dumbass==sheep){
printf( "Enter the two numbers to be added:\n" );
scanf( "%d", &A );
scanf( "%d", &S );
printf( "Your numbers were %d and %d. Their sum is: %d\n", A, S, add (A,S) );
getchar();
}
else if (dumbass==skin){
printf( "Enter the two numbers to be subtracted:\n" );
scanf( "%d", &D );
scanf( "%d", &F );
printf( "Your numbers were %d and %d. Their difference is: %d\n", D, F, dif (D,F) );
getchar();
}
else if (dumbass==seat){
printf( "Enter the two numbers to be multiplied:\n" );
scanf( "%d", &Q );
scanf( "%d", &W );
printf( "Your numbers were %d and %d. Their product is: %d\n", Q, W, mult (Q,W) );
getchar();
}
else if (dumbass==covers){
printf( "Enter the two number to be divided:\n" );
scanf( "%d", &E );
scanf( "%d", &R );
if (R == 0){
printf( "I'm sorry, Dave. I'm afraid I can't do that.\n" );}
else if (E == 0){
printf( "Uh, you can't divide nothing.\nNo matter how badly you want to share it with your friends.\n" );}
else printf( "Your numbers were %d and %d. Their quotient is: %d\n", E, R, div (E,R) );
getchar();
}
}
int add (int A, int S)
{
return A + S;
}
int dif (int D, int F)
{
return D - F;
}
int mult (int Q, int W)
{
return Q * W;
}
int div (int E, int R)
{
return E / R;
}
-Hiru