-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglobalV.c
55 lines (49 loc) · 1.04 KB
/
globalV.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
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
FILE *fpw;
void half(void);
//void half(int, float);
//void twice(void);
void twice(int, float);
//int age;
//float feet;
int main()
{
int age;
float feet;
fpw = fopen("./Info.txt","w");
printf("How old are you: ");
scanf("%d",&age);
printf("How tall are you (in feet): ");
scanf("%f",&feet);
printf("You are %d years old and %.1f feet tall.\n", age,feet);
half();
//half(age,feet);
//twice();
twice(age,feet);
printf("But you're not really %d years old or %.1f feet tall\n",age,feet);
fclose(fpw);
return(0);
}
//void half(int age,float feet)
void half()
{
//int age;
//float feet;
float a,h;
a=(float)age/2.0;
printf("Half your age is %.1f.\n",a);
fprintf(fpw,"Half your age is %.1f.\n",a);
h=feet/2.0;
printf("Half your height is %.1f.\n",h);
fprintf(fpw,"Half your height is %.1f.\n",h);
}
void twice(int a,float b)
//void twice()
{
//int age;
//float feet;
a*=2;
printf("Twice your age is %d.\n",a);
b*=2;
printf("Twice your height is %.1f.\n",b);
}