@Dave1/

ImmenseStainedSpellchecker-2

C

No description

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <string.h>

struct employee
{
  char fname[20];
  char lname[20];
  int age;
  float weight;
};

void printEmployee(struct employee tool); 
float weightChange(struct employee tool, float change); 

int main(void)
{
  struct employee employee1;
  
  employee1.age = 47;
  employee1.weight = 120;

  strcpy(employee1.fname, "Leo");
  strcpy(employee1.lname, "Da Vinci"); 

  printEmployee(employee1);
  printf("----------------\n");
  employee1.weight = weightChange(employee1, -13.3);
  printEmployee(employee1);

  return 0;
}


float weightChange(struct employee tool, float change) 
{
  return tool.weight + change; 
} 

void printEmployee(struct employee tool) 
{
 printf("Employee's name is %s %s\n",tool.fname, tool.lname);
 printf("Employee's age is %d\n", tool.age);
 printf("Employee's weight is %f\n", tool.weight);
}