// 10162009.cpp, P H Anderson, Oct 16, '09

#include <stdio.h>
#include <stdlib.h>
#include <string.h>   

typedef struct
{
   int a;
   int b;
   int c;
} THREE_VALS;

typedef struct
{
   int id;
   int sal;
   int age;
} EMPLOYEE;

int compare_strings(char *s1, char *s2);
int str_to_int(char *s);
void int_to_str(int v, char *s);
   
int find_max(THREE_VALS three_vals);
THREE_VALS arrange_three(THREE_VALS three_vals);
   
EMPLOYEE fetch_record(void);
void print_record(EMPLOYEE emp);
void sort_employees(EMPLOYEE *a, int num);
void swap_employees(EMPLOYEE *p1, EMPLOYEE *p2);
 
 
int main()
{
    EMPLOYEE employees[2] = {{0000, 00000, 00}, {1111, 11111, 11}};
    print_record(employees[0]);
    employees[0] = fetch_record();
    print_record(employees[0]);
    sort_employees(employees, 2);
    print_record(employees[0]);
    print_record(employees[1]);
    system("pause");
}
    
EMPLOYEE fetch_record(void)
{ // stub
    EMPLOYEE a = {6676, 62500, 55};
    return(a);         
} 
void print_record(EMPLOYEE emp)
{ // stub
    printf("%6d\n", emp.id);
}
void sort_employees(EMPLOYEE *a, int num)
{ // stub
    swap_employees(&a[0], &a[1]);
}

void swap_employees(EMPLOYEE *p1, EMPLOYEE *p2)
{
    EMPLOYEE tmp;
    tmp = *p1;
    *p1 = *p2;
    *p2 = tmp;
}

int find_max(THREE_VALS three_vals)
{ // stub
    return(1);
}
    
THREE_VALS arrange_three(THREE_VALS three_vals)
{ // stub
    THREE_VALS x = {1, 2, 3};
    x.a = x.a + three_vals.a; x.b = x.b + three_vals.b; x.c = x.c + three_vals.c;
    return(x);
}
int compare_strings(char *s1, char *s2)
{ // stub
   return(-1);
}

int str_to_int(char *s)
{  // stub
    return(2);
}

void int_to_str(int v, char *s)
{ // stub
   strcpy(s, "1324");
}    

#ifdef OUTPUT
     0
  6676
  1111
  6676
Press any key to continue . . .
#endif