Thanks zacs7,
a finished product! (i had been working on this stupid program and trying different loops etc for 2 weeks!!! before i found this site)
does the indenting look ok now?
Code:
#include <stdio.h>
/***************************/
/*** main functions!!!!! ***/
/***************************/
int main (void)
{
char ch;
while(ch == '+' || '-' || '*' || '/')
{
printf("Please Choose From + - * / :");
scanf("\n%c%*[^\n]%*c", &ch);
equation(ch);
}
}
/*********************************/
/*** equation function!!!!!!! ****/
/*********************************/
equation(ch)
{
float a,b,c;
switch(ch)
{
case '+' : printf("Please enter in each number followed by hitting the enter key\n");
scanf("%g", &a);
scanf("%g", &b);
c = a + b;
printf("%g + %g = %g\n", a,b,c);
break;
case '-' : printf("Please enter in each number followed by hitting the enter key\n");
scanf("%g", &a);
scanf("%g", &b);
c = a - b;
printf("%g - %g = %g\n", a,b,c);
break;
case '*' : printf("Please enter in each number followed by hitting the enter key\n");
scanf("%g", &a);
scanf("%g", &b);
c = a * b;
printf("%g * %g = %g\n", a,b,c);
break;
case '/' : printf("Please enter in each number followed by hitting the enter key\n");
scanf("%g", &a);
scanf("%g", &b);
c = a / b;
printf("%g / %g = %g\n", a,b,c);
break;
}
}/***equation function end***/