ANSWERS: 2
-
Every time i press any key it should increment 'calls' and $0.48 to 'money'. and should REWRITE the log file. my log file wont work properly!... some one PLEASE HELP! MY CODE: # include <stdio.h> # include <stdlib.h> # include <math.h> # include <time.h> # include <windows.h> void filewrite (int calls, double money){ FILE *file; printf ("nRUNNING MACRO...nn CAERFUL, every time you press a key, it will count a as call and $0.48n"); money=money-0.48; calls--; do{ money=money+0.48; calls++; file = fopen ("123.txt","r"); printf("nnMoney: %.2f Calls: %dn", money , calls); fprintf(file, "%.2f %dn", money , calls); fclose(file); system("pause"); }while(1); } int main(){ int x=0, y=0, i, calls=0; double money; FILE *file; file = fopen ("123.txt","w"); if (file == NULL) { printf ("SORRY CAMRON, The file couldnt be found. msg me if there is a problem!nn"); system ("pause"); return 1; } printf ("if you want to input custom data enter 1:nnif you want to continue with the file enter 2:"); scanf("%d", &x); if (x==1){ calls=0; printf ("enter the number of calls already made: "); scanf("%d", &calls); system("cls"); money=calls*0.48; fprintf(file, "%.2f %d", money , calls); system("cls"); filewrite (calls, money); } else if(x==2){ fscanf(file, "%.2f %d", &money , &calls); filewrite (calls, money); } else {system("cls"); printf("tnnWTF...ERRORaa"); printf("tnnWTF...ERRORaa"); printf("tnnWTF...ERRORaa"); } fclose(file); system("pause"); return 0; }
-
Can you tell me what specifically error you are getting during compilation, or assuming it compieles correctly, what specifically it is not doing that it should?
Copyright 2023, Wired Ivy, LLC

by 