Program9_1 - 145500, {"August",...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "stdio.h" #include "string.h" struct date { char month[10]; int day; int year; void init(char *m, int d, int y) { strcpy (month, m); day = d; year = y; } void print() { printf("%10s/%2d/%2d",month, day, year); } }; struct record { char name[80]; double pay; date DOB; void init(char *n, double p, char *m, int d, int y) { strcpy (name, n); pay = p; DOB.init(m,d,y); } void print() { printf("%10s $%10.2lf ",name, pay); DOB.print(); printf("\n"); } }; record TheRecords[100] = { {"bill", 42000, {"July", 23, 1978} }, {"Fred", 12000, {"May", 19, 1956} }, {"Tom", 76000, {"April", 5, 1932} }, {"Sam", 123000, {"March", 12, 1981} }, {"Carlos", 56000, {"June", 25, 1965} }, {"Ali", 32500, {"Decamber", 19, 1987} }, {"Chen", 26750, {"October", 23, 1977} }, {"Gary", 76800, {"May", 8, 1983} }, {"Anna",
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 145500, {"August", 14, 1964} } }; void printrecords(record r[100], int n) { int i; for (i = 0; i < n; i++) r[i].print(); } void get_new_record(int i) { char name[80], month[12]; int day, year; double pay; printf("enter person's name\n"); scanf("%s",name); printf("enter person's pay\n"); scanf("%lf", &pay ); printf("enter person's DOB month\n"); scanf("%s",month); printf("enter person's DOB day\n"); scanf("%d", &day ); printf("enter person's DOB year\n"); scanf("%d", &year ); TheRecords[i].init(name,pay,month,day,year); } int main() { printrecords(TheRecords,9); get_new_record(9); printrecords(TheRecords,10); return 0; }...
View Full Document

This note was uploaded on 09/16/2011 for the course EGN 3210 taught by Professor Fernando during the Spring '05 term at University of Central Florida.

Page1 / 2

Program9_1 - 145500, {"August",...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online