Advertisement
Guest User

Help w/ code

a guest
Feb 26th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. int main(){
  7.     //Initialize Required Variables For Program
  8.     int patientCount = 0;
  9.     string id;
  10.     int avg = 0;
  11.     int howMany = 0;
  12.     ifstream reader ("data.txt"); //Open The Data File To Be Read From
  13.  
  14.     while( reader >> id && reader >> howMany ){ //as long as you can read another pacient data
  15.         int sum = 0; //sum accumulates the pressure readings per pacient
  16.         cout << "The Patient ID Is: " << id << endl;
  17.         cout << "The Number Of Blood Pressure Record This Patient Has Is: " << howMany << endl;
  18.         for(int K = 0; K < howMany; ++K){
  19.             int number;
  20.             reader >> number;
  21.             sum += number;
  22.  
  23.         }
  24.         //compute the average here
  25.  
  26.     }
  27.     system("pause");
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement