Hi I never usually post assignments I need help on but this one has me stumped. This program is not finished and its basically in dummy format. I have been adding a little bit as I go along.

Anyway the assignment is to create a simple payroll program using one dimensional arrays and a vector to store the names. I am not allowed to use OOP which would make things easier. The problem lies in the first function after main. It never allows me to enter the correct amount of names. This value is passed from main and entered by the user.

For exmaple, if I type in 3 names to process I can only enter 2 names but the other functions appear to be working as nornal.

I dont know what I am doing wrong, the rest of the code works as it should. I declared the vector correct in the function.

Code:
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>

// function prototyes
void inputNames ( int& );
void inputPayRate ( const std::vector<std::string> &, int& );
void inputHoursAndProcessResult ( const std::vector<std::string> &,
     int&, double[] );

// main - begins program execution /////////////////////////////////////////////
//
int main(int argc, char *argv[])
{
   std::cout << std::setprecision( 2 ) << std::fixed;

   int totalEmployees;

   std::cout << "Enter total amount of employees to compute: ";
   std::cin >> totalEmployees;

   while ( totalEmployees != -1 )
   {
      inputNames ( totalEmployees );

      std::cout << "\nEnter total amount of employees to compute: ";
      std::cin >> totalEmployees;
   }

   std::cin.get(); // freeze console output window

   return 0; // return value from main to OS
}

// funcion to input the names of the employees
void inputNames ( int &rTotEmp )
{
   std::vector<std::string> names( rTotEmp, "" );

   std::cout << "\n\nEnter the " << rTotEmp << " employee names pressing return"
             << "\nafter each input\n\n> ";

   for ( int i = 0; i < names.size(); i++ )
   {
      getline ( std::cin, names[ i ] );
   }

   inputPayRate ( names, rTotEmp );
}

// function to enter the hourly rate of each employee
void inputPayRate ( const std::vector<std::string> &vec, int &rTotEmp )
{
   double payRate [ rTotEmp ];

   std::cout << "\n\nEnter the " << rTotEmp << " pay rate for each\n"
             << "employee pressing return after each input\n\n> ";

   for ( int i = 0; i < rTotEmp; i++ )
   {
      std::cin >> payRate[ i ];
   }

   inputHoursAndProcessResult ( vec, rTotEmp, payRate );
}

// function to input the hours worked, calcuate salary and
// display result it tabular format
void inputHoursAndProcessResult ( const std::vector<std::string> &vec,
     int &rTotEmp, double pay[] )
{
   double hours [ rTotEmp ];

   std::cout << "\n\nEnter the " << rTotEmp << " hours for each\n"
             << "employee pressing return after each inpuy\n\n> ";

   for ( int i = 0; i < rTotEmp; i++ )
   {
      std::cin >> hours[ i ];
   }

   std::cout << "\nEMPLOYEE NAME" << std::setw( 12 ) << "PAY RATE"
             << std::setw( 12 ) << "HOURS\n\n";

   // display final data in table format
   for ( int i = 0; i < rTotEmp; i++ )
   {
      std::cout << vec[ i ] << std::setw( 19 ) << pay[ i ] << std::setw( 19 )
                << hours[ i ] << std::endl;
   }
}