SHARE
TWEET

Heart Rate[statmh]

a guest May 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  main.c
  3. //  HeartRate
  4. //
  5. //  Created by HAMMSASUKE on 3/28/17.
  6. //  Copyright © 2017 HAMMSASUKE. All rights reserved.
  7. //
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <time.h>
  12.  
  13. int main(int argc, const char * argv[]) {
  14.    
  15.     int BPM[50][180];
  16.     int i, j, w, x, y, choice;
  17.    
  18.     printf("Heart Rate Recording \n(1)Normal (2)Stress (3)Sleepy\nEnter: ");
  19.     scanf("%d", &choice);
  20.     printf("----------------\n");
  21.    
  22.     srand (time(NULL));
  23.    
  24.     for (i=0; i<50; i++) {
  25.         printf("Day: %d\n", i+1);
  26.         x = rand() % 16 + 69;
  27.         if(choice==3)x = x-5;
  28.         else if (choice==2)x = x+5;
  29.         else;
  30.         for (j=0; j<180; j++) {
  31.             w = x+4;
  32.             y = rand() % 6 + w;
  33.             printf("%d ", y);
  34.             BPM[i][j]=y;
  35.         }
  36.         printf("\n----------------\n");
  37.     }
  38.    
  39.     FILE *fp;
  40.     // Modify your path here ...
  41.     fp = fopen("/Users/Admin/Desktop/HR.txt", "w+");
  42.     for (i=0; i<50; i++) {
  43.         fprintf(fp, "Day%d: ", i+1);
  44.         for (j=0; j<180; j++) {
  45.             fprintf(fp, "%d ", BPM[i][j]);
  46.         }
  47.        fprintf(fp, "\n");
  48.     }
  49.      printf("File Exported...\n");
  50.     fclose(fp);
  51.    
  52.     return 0;
  53. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top