I just tried the function on the page and used it how he did on the 2nd page (thanks for those btw) But it's STILL skipping over the first input spot. Let me show you what I have:
Code:
#include <stdio.h>
#include <stdlib.h>
void selection();
void selection()
{
char temp, choice[10], number1[10],number2[10];
int n,n2,ch;
printf("Type in \'+\' for addition, \'-\' for subtraction,");
puts(" \'/\' for division, \'*\' for multiplication, and \'^\' for power");
printf("Please enter your choice: ");
getline(choice, 10);
ch = atoi(choice);
printf("Now enter the two numbers IN ORDER e.g. 5 then 2 for 5-2: ");
getline(number1, 10);
n = atoi(number1);
getline(number2, 10);
n2 = atoi(number2);
/*#####################################*/
/*#####################################*/
/*Switch statement uses ASCII codes*/
/*#####################################*/
/*#####################################*/
switch (ch)
{
case 43:
puts("Calculating...");
addition(n,n2);
break;
case 45:
puts("Calculating...");
subtraction(n,n2);
break;
case 47:
puts("Calculating...");
division(n,n2);
break;
case 42:
puts("Calculating...");
multiplication(n,n2);
break;
case 94:
puts("Calculating...");
power(n,n2);
break;
default:
puts("Please enter one of the operations listed ONLY");
break;
}
}
The getline function definition is in a header file included by the main file of the program. I don't think that is the problem anyway. It keeps skipping over just like I posted in the first posting in this thread.