so i do loop for ex:
Code:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;
const int number_of_rows=40;
void empinfo(char empname[][30],unsigned int hours[][30],float moneydata[][6],int x, int counter);
int main()
{
char empname[30][30];
unsigned int hours[30][30];
float moneydata[30][6];
int x= 30;
int counter = 0;
char choice;
char answer;
cout<<"Welcome to the Payroll Report for the week! \n";
cout<<"Please be sure to enter the information accurately. \n";
cout<<" You will be promted with the following \n";
cout<<"\nEmployee's Name: \n";
cout<<"Amount of Hours of each workday: \n" ;
cout<<"Emplyee's Rate(wage per hour): \n";
cout<<"Amount of Dependents: \n";
cout<<"Healthplan( Y or N): \n";
cout<<"Are there more employees(Y or N)?\n";
cout<<"Would you like to continue?( Y or N)\n";
cin>>choice;
switch(choice)
{
case 'Y':
case 'y':
do
{
counter++;
empinfo(empname,hours,moneydata,x, counter);
cout<<"Are there more employees?(Y or N) \n";
cin>>answer;
}while(answer='Y');
return 0;
}
}
void empinfo(char empname[][30],unsigned int hours[][30],float moneydata[][6],int x, int counter)
{
cout<<"Employee's Name: \n";
cin.clear();
int stack;
cout<<stack + 1<<endl;
do
{
for(int j=0;j<stack;j++)
{
cin.get(empname[counter][j]);
cin.ignore();
cin.clear();
}
}while(stack!=0);
cout<<"Amount of Hours Each Day: \n";
for(int h=0;h<7;h++)
{
if(h>7)
{
cout<<"Please only enter a 7 day schedule \n";
cin>>hours[h][30];
}
}
cout<<"Employee's Rate: \n";
for(int r=0;r<counter;r++)
{
cin>>moneydata[r][0];
}
}
the program works but it will only stores 1 char of the name...
so if the name is Zerlok Zerlok..only the z would be stored if i put a whole name it skips my whole program i'm not sure what i'm doing wrong..=\