-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcedure.cpp
More file actions
40 lines (34 loc) · 1.26 KB
/
Procedure.cpp
File metadata and controls
40 lines (34 loc) · 1.26 KB
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
//------------------------------------------------------------------------------
// Procedure.cpp - implementation of Procedure.h.
//------------------------------------------------------------------------------
#include "Procedure.h"
//------------------------------------------------------------------------------
// Input parameters from file.
void Procedure::In(Procedure &c, FILE *file) {
fscanf(file, "%100s", &c.name);
fscanf(file, "%i", &c.year);
fscanf(file, "%lf", &c.popularity);
fscanf(file, "%i", &c.abstract_type);
}
// Random parameters.
void Procedure::InRnd(Procedure &c) {
c.abstract_type = bRandom();
c.popularity = dRandom();
c.year = yRandom();
int k = 0;
for(char i = 'a'; i < 'z'; i++){
c.name[k] = i;
k++;
}
}
//------------------------------------------------------------------------------
// Output
void Procedure::Out(Procedure &c, FILE *file) {
if (c.abstract_type){
}
fprintf(file, "It is Procedure language: Have abstract type %i\n", c.abstract_type);
fprintf(file, ". Popularity = %lf\n", c.popularity);
fprintf(file, ". Year = %i\n", c.year);
fprintf(file, ". Parameter = %lf", c.Average(c));
}
//------------------------------------------------------------------------------