Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 20th, 2005, 8:58 AM   #1
hopeolicious
Newbie
 
Join Date: Feb 2005
Posts: 8
Rep Power: 0 hopeolicious is on a distinguished road
reading records from a file

Can someone help me to figure his out. I have to read in a file that contains employee names, numbers, payrates, and hours. Then I have to calculate the gross andsend everything to an output file. I keep getting this error message

"employee.cpp" 69 lines, 1471 characters
$ c++ employee.cpp
Undefined first referenced
symbol in file
putdata(char *, int, float) /var/tmp/cckpUsol.o
getdata(char *, int, float, int) /var/tmp/cckpUsol.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
$

this is my program

#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

const int MAXNAME = 20;
const int NUMRECS = 12;
int i=0;

struct employees
{
int number, hours;
float rate, gross;
char name[MAXNAME];
}employee;

int employees[NUMRECS];

void getdata(char [], int, float, int);
void processdata(float, int);
void putdata(char [], int, float);

ifstream HopeData;
ofstream MikeData;

void main()
{


HopeData.open("personel.dat");
MikeData.open("putdata");

if(HopeData.fail())
{
	cout << "\n\nFile not successfully opened\n\n";
}
cout << "\n\nFile successfully opened\n\n";

getdata(employee.name, employee.number, employee.rate, employee.hours);

putdata(employee.name, employee.number, employee.gross); 

HopeData.close();
MikeData.close();
}

void getdata(int name[], int number, float rate, int hours)
{
		while(i < NUMRECS)
		{

HopeData >> employee.name >> employee.number >> employee.rate >> employee.hours;
		}
processdata(employee.rate, employee.hours);
}

void processdata(float rate, int hours)
{
employee.gross = employee.rate * employee.hours;
}

void putdata(char name, int number, float gross)
{
cout << "\n\n              Payroll  Report" << endl;
cout << "        Name        Number        Gross Pay" << endl;    
		cout << setiosflags(ios::showpoint);
		cout << setiosflags(ios::fixed);
		cout << setprecision(2);
		cout << setw(15) << employee.name << setw(5) << "\t" << employee.number << setw(7) << "\t$" << employee.gross << endl;

}

And this is a sample of my file that i'm reading

Simmons 2242 8.00 40
Alexander 8343 5.98 40
Jenkins 6234 4.65 23
Gardiner 1009 9.34 40
Ward 2289 3.57 40
Simien 5342 3.09 40
Smith 7344 7.00 40
Fresch 2942 6.50 40
Donato 5034 8.09 40
Glasper 1276 8.32 40
Marsh 8234 7.98 40
Fontenot 2454 6.95 40
Johnson 1523 6.98 40
Deville 2212 1.45 40
Clay 1912 2.89 40
hopeolicious is offline   Reply With Quote
Old Apr 20th, 2005, 9:26 AM   #2
spydoor
Programmer
 
Join Date: Feb 2005
Posts: 64
Rep Power: 4 spydoor is on a distinguished road
your function prototypes do not match your function definitions

getdata prototype (char[], int , float, int)
getdata definition (int[], int, float, int)

similar for putdata, in the prototype your first argument is a char[] , in the definition your first argument is just a char
spydoor is offline   Reply With Quote
Old Apr 20th, 2005, 9:36 AM   #3
hopeolicious
Newbie
 
Join Date: Feb 2005
Posts: 8
Rep Power: 0 hopeolicious is on a distinguished road
thanx so much
hopeolicious is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:09 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC