I too am making a calculator and I looked the other threads about calculators and mine is not that complicated because we haven't learned some of those things but anyway. we have to do ours in functions. i've wriiten these functions using arrays because the input is coming at a max of 20 for all functions accept the power function. I think my power function is wrong because it's not doing the right thing also i think my other functions are missing something because it seems to easy. any ideas?thank you.
Code:
float power_func(float firsval, int seconval){                                                                                                 
  int count;                                                                                                                                   
  float powerval;                                                                                                                              
  if (firsval < 0){                                                                                                                            
    firsval = -1;                                                                                                                              
    seconval= 1/seconval;                                                                                                                      
  }                                                                                                                                            
  for(count = 0; count < firsval; count++){                                                                                                    
    powerval *= seconval;                                                                                                                      
  }                                                                                                                                            
  return powerval;                                                                                                                             
}    
                                                                                                                                               
float add_arr(float adarry[]){                                                                                                                 
  int count;                                                                                                                                   
  float sum = adarry[0];                                                                                                                       
  for(count = 1; count < MAX; count++){                                                                                                        
    sum += adarry[count];                                                                                                                      
  }                                                                                                                                            
  return sum;                                                                                                                                  
}                                                                                                                                              
                                                                                                                                                                                                                                                                                        
float subtract_arr(float subarry[]){                                                                                                           
  int count;                                                                                                                                   
  float difference = subarry[0];                                                                                                               
  for(count = 1; count < MAX; count++){                                                                                                        
    difference -= subarry[count];                                                                                                              
  }                                                                                                                                            
  return difference;                                                                                                                           
}                                                                                                                                              
                                                                                                                                                                                                                                                                                              
float multiply_arr(float multarry[]){                                                                                                          
  int count;                                                                                                                                   
  float product = multarry[0];                                                                                                                 
  for(count = 1; count < MAX; count++){                                                                                                        
    product *= multarry[count];                                                                                                                
  }                                                                                                                                            
  return product;                                                                                                                              
}