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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#include <iostream>
#include <string>
#include <fstream>
#include <stdio.h>
#include <iostream>
float a,b;
float BMI;
int AddBiometric();
void calculatBMI(float x, float y, float &BMI);
void caluclateBMI(float x, float y, float &BMI)
{
BMI = (a / (float(b) *float (b)));
}
int main()
{ char c;
FILE *file;
std::cout<<"To Add Weight: Type W\n";
std::cout<<"To Add Height: Type H\n";
std::cout<<"Selection>";
std::cin>>c;
if (c == 'w')
{
std::cout<<"Enter the Weight in pounds:\n";
std::cin>>a;
std::cout<<"Biometric Added\n";
file= fopen("health_record.dat","a");
fprintf(file,"W ");
fprintf(file,"%f\n",a);
}
else if(c == 'h')
{
std::cout<<"Enter the Hight in feet:\n";
std::cin>>b;
std::cout<<"Biometric Added\n";
file= fopen("health_record.dat","a");
fprintf(file,"H ");
fprintf(file,"%f\n",b);
}
void calculatBMI(a,b,&BMI);
fclose(file);
}
|