Please take a VERY close look at this (especially the bold parts):
Code:
#include <stdio.h>
#include <stdlib.h>
void selection();	



void selection()
{
    int choice = 0;
    char number1[50];
    char number2[50];
    char prechoice[50];
    float n = 0.0;
    float n2 = 0.0;

    printf("Enter the two numbers IN ORDER e.g. 5 then 2 for 5-2\n");
    printf("Enter the first number: ");
	if (fgets(number1, sizeof(number1), stdin) != NULL)
  	{
		printf("%s is number1\n",number1);
    		n = atof(number1);
		printf("%f is n\n",n);
  	}  
    printf("\nAnd now the second number: ");
	if (fgets(number2, sizeof(number2), stdin) != NULL)
  	{
		printf("%s is number2\n",number2);
    		n2 = atof(number2);
		printf("%f is n2\n",n2);
  	}  

    printf("\n\nNow type in \'1\' for addition, \'2\' for subtraction,");
    puts(" \'3\' for division, \'4\' for multiplication, and \'5\' for power");
    printf("Please enter your choice: ");
	if (fgets(prechoice, sizeof(prechoice), stdin) != NULL)
  	{
	choice = atoi(prechoice);
		printf("%d is choice\n",choice);
  	}  

    switch (choice) {
    case 1:
	puts("Calculating...\n");
	printf("%f is n\n",n);
	printf("%f is n2\n",n2);
	addition(n, n2);
	break;
    case 2:
	puts("Calculating...\n");
	subtraction(n, n2);
	break;
    case 3:
	puts("Calculating...\n");
	division(n, n2);
	break;
    case 4:
	puts("Calculating...\n");
	multiplication(n, n2);
	break;
    case 5:
	puts("Calculating...\n");
	power(n, n2);
	break;
    default:
	puts("Please enter one of the operations listed ONLY");
	menu();
    }
}
Pretend we are only working with addition here, to get this problem solved. See how I stuck a bunch of printf's in there? Well, this was to show me that the variables are actually carrying the correct values. Which is the case. Now look at this snippet from my header file:
Code:
void addition(float number1,float number2);
void addition(float number1,float number2)
{
	float answer;
	answer = number1+number2;
	printf("%f + %f = %f\n",number1,number2,answer);
	menu();
}
I enter 5 for the first number and 9 for the second. According to the code above (which I tested by running the .exe) I get this:
Enter two numbers IN ORDER e.g. 5 then 2 for 5-2
Enter the first number: 5
5
is number1
5.000000 is n

And now the second number: 9
9
is number2
9.000000 is n2
(Note from Padawan: Everything is fine see?)




Now type in '1' for addition, '2' for subtraction, '3' for division, '4' for multiplication, and '5' for power
Please enter your choice: 1
1 is choice
Calculating...
5.000000 is n
9.000000 is n2
(Note from Padawan: Notice how the variables are STILL FINE)
(Cont. Note: These variables are now passed to the addition function)
0.000000 + 2.37500 = 2.37500
(Note from Padawan: I have noooooo clue where that came from, do you?)
As you can see, something odd is going on in my code once again. This time it appears to be something with the passing of the variables to the function. ButI have no clue what. Can someone help me out here? I'd appreciate it more than you can possibly imagine because it's now been a full 24 hours since I started this simple calculator project.