1. ## win32 calculater

Hi
I have written my first, basic, meaninglyfull program. I feel i have done everything to it, that i can do in its current state. I would really wish to transfrom it into a win32 apllication with buttons for numbers and a screen for the calcultor for the letters to come up. Could someone help me (not write the program for me - i am here to learn) here is the code if it helps:

Code:
``` #include <stdio.h>
#include <stdlib.h>

main ()

{
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;

printf("What would you like to do?\n1=Add\n2=Subtract\n3=Multiply\n4=Divide");
scanf("%d",&a);

if(a==1)
{printf("What is the first number you would like to add?");
scanf("%d",&b);
printf("What is the second number you would like to add?");
scanf("%d",&c);
d=b+c ;
scanf("%d");}

if(a==2)
{printf("What is the first number you would like to subtract?");
scanf("%d",&e);
printf("What is the second number you would like to subtract?");
scanf("%d",&f);
g=e-f;
scanf("%d");}

if(a==3)
{printf("What is the first number you would like to multiply?");
scanf("%d",&e);
printf("What is the second number you would like to multiply?");
scanf("%d",&f);
g=e*f;
scanf("%d");}

if(a==4)
{printf("What is the first number you would like to divide?");
scanf("%d",&e);
printf("What is the second number you would like to divide?");
scanf("%d",&f);
g=e/f;
scanf("%d");}

return 0;
}```

2. I feel i have done everything to it, that i can do in its current state.
What about square root or exponents? In math.h there is a sqrt() function for getting the square root and you can use a loop to do exponents.

Code:
`main()`
main() returns an integer.
Code:
`int main(void)`
You should use floats or doubles to do division. Otherwise the user cant get decimals.

3. Here's another way to write your program using functions:
Code:
```#include <stdio.h>

int func_add(int num1, int num2)      { return num1 + num2; }
int func_subtract(int num1, int num2) { return num1 - num2; }
int func_multiply(int num1, int num2) { return num1 * num2; }
int func_divide(int num1, int num2)   { return num1 / num2; }

int main(void)
{
struct
{
char *name;
int (*func)(int, int);
} list[] = { { "Add", func_add }, { "Subtract", func_subtract },
{ "Multiply", func_multiply }, { "Divide", func_divide } };
int num1, num2;
int i;
int choice;

puts("What would you like to do?");
for(i = 0;i < 4;++i)
printf("%d=%s\n", i + 1, list[i].name);

scanf("%d", &choice);

if(choice >= 1 && choice <= 4)
{
choice--;
printf("What is the first number you would like to %s? ",
list[choice].name);
fflush(stdout);
scanf("%d", &num1);
printf("What is the second number you would like to %s? ",
list[choice].name);
fflush(stdout);
scanf("%d", &num2);
printf("Your number is %d\n", list[choice].func(num1, num2));
}

return 0;
}```

4. First of all, instead of all the ifs, you can use a switch statement....

Anyways..to your question. I've never done what you are trying to accomplish in C without using graphics functions which was harder for me. My first calculator I wrote in Visual Basic, which looked pretty close to your code, yet in VB you can just draw the buttons out.