Is there any way I can save the details of performed operations to a binary file and retrieve them when required?
Let's say the program of a calculator. An option can be provided where a user can save all the performed tasks' history to a binary file and can retrive that data later on.
For example: (Output screen)
--------------------------------------------------------------------------
Menu>>Trigonome try>> Roots calculation
Enter equation: cos(2x)-2sin(x)cos(x)
Calculating. . .
Result: x=(π/8)+k(π/2) , k∈Z
Press: 's' to save the record, 'r' to return to the main menu
-------------------------------------------------------------------------
*when the user presses 's', the record should be saved in the binary/text file as*:
Date: dd/mm/yyyy Time: [hh]:[mm]
Category: Menu>>Trigonome try>> Roots calculation
Input(s): cos(2x) -2sin(x)cos(x)
Result(s): x=(π/8)+k(π/2) , k∈Z
*similarly for others as*
Date: dd/mm/yyyy Time: [hh]:[mm]
Category: Menu>>Polynomia ls>>Addition
Input(s): [7x^2]+[4x^5] , [3x^2]+[6x^9]
Result(s): [10x^2]+ [4x^5]+ [6x^9]
-----------------------------------------------------------------------
And hence, the user can request that data later on (from the main menu) accordingly like if he wants to view the saved records of a particular date..
I feel like this can be implemented using class objects dealing with files and time libraries. Is this feasible?
Let's say the program of a calculator. An option can be provided where a user can save all the performed tasks' history to a binary file and can retrive that data later on.
For example: (Output screen)
--------------------------------------------------------------------------
Menu>>Trigonome try>> Roots calculation
Enter equation: cos(2x)-2sin(x)cos(x)
Calculating. . .
Result: x=(π/8)+k(π/2) , k∈Z
Press: 's' to save the record, 'r' to return to the main menu
-------------------------------------------------------------------------
*when the user presses 's', the record should be saved in the binary/text file as*:
Date: dd/mm/yyyy Time: [hh]:[mm]
Category: Menu>>Trigonome try>> Roots calculation
Input(s): cos(2x) -2sin(x)cos(x)
Result(s): x=(π/8)+k(π/2) , k∈Z
*similarly for others as*
Date: dd/mm/yyyy Time: [hh]:[mm]
Category: Menu>>Polynomia ls>>Addition
Input(s): [7x^2]+[4x^5] , [3x^2]+[6x^9]
Result(s): [10x^2]+ [4x^5]+ [6x^9]
-----------------------------------------------------------------------
And hence, the user can request that data later on (from the main menu) accordingly like if he wants to view the saved records of a particular date..
I feel like this can be implemented using class objects dealing with files and time libraries. Is this feasible?
Comment