Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.c
- // HeartRate
- //
- // Created by HAMMSASUKE on 3/28/17.
- // Copyright © 2017 HAMMSASUKE. All rights reserved.
- //
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main(int argc, const char * argv[]) {
- int BPM[50][180];
- int i, j, w, x, y, choice;
- printf("Heart Rate Recording \n(1)Normal (2)Stress (3)Sleepy\nEnter: ");
- scanf("%d", &choice);
- printf("----------------\n");
- srand (time(NULL));
- for (i=0; i<50; i++) {
- printf("Day: %d\n", i+1);
- x = rand() % 16 + 69;
- if(choice==3)x = x-5;
- else if (choice==2)x = x+5;
- else;
- for (j=0; j<180; j++) {
- w = x+4;
- y = rand() % 6 + w;
- printf("%d ", y);
- BPM[i][j]=y;
- }
- printf("\n----------------\n");
- }
- FILE *fp;
- // Modify your path here ...
- fp = fopen("/Users/Admin/Desktop/HR.txt", "w+");
- for (i=0; i<50; i++) {
- fprintf(fp, "Day%d: ", i+1);
- for (j=0; j<180; j++) {
- fprintf(fp, "%d ", BPM[i][j]);
- }
- fprintf(fp, "\n");
- }
- printf("File Exported...\n");
- fclose(fp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement