473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

How to save the the details of performed operations to a file?

dev7060
633 Expert 512MB
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>>Trigonometry>> 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>>Trigonometry>> 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>>Polynomials>>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?
May 31 '18 #1

✓ answered by weaknessforcats

You will need to read up on file handling in C++. Most likely you will use a stream object, like ofstream.

Be sure you read the data in your file in the same order that it was written.

This will get you started:

https://bytes.com/topic/c/insights/9...te-text-file-c

https://bytes.com/topic/c/insights/9...ad-text-file-c

1 1243
weaknessforcats
9,208 Expert Mod 8TB
You will need to read up on file handling in C++. Most likely you will use a stream object, like ofstream.

Be sure you read the data in your file in the same order that it was written.

This will get you started:

https://bytes.com/topic/c/insights/9...te-text-file-c

https://bytes.com/topic/c/insights/9...ad-text-file-c
May 31 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Marc Hoeijmans | last post by:
Hi, We like to save the emails we send as textfile on a file server. I want to use the System. Web.Mail class for sending the email. The question is how can i save the message as file. I have...
2
by: Chris | last post by:
How do I save an array of bytes to a file? I am binding a update parameter to a fileupload control. It passes the file to my object as a Filebytes datatype. I am assuming it is just an array of...
12
by: Wernerh | last post by:
Hi everyone. Please could anyone tell me where I am going wrong in this code. I have a webcam connected that captures the a pic through this code. When I execute the code it does not save it to the...
4
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
All, I present some data on the window form, then I try to save window form as file on the local C drive, like save word file, can anyone know how? Thanks, Martin
0
by: phanibiddu | last post by:
How to draw on windows form and save it as Jpeg file I am trying with this code but not comming public Form3() { InitializeComponent(); //rnd = new...
4
by: minhtran | last post by:
Hi All I create web page as ASP.NET . The program runs on localhost no problem,but when we upload on server has an error as : An unhandled exception occurred during the execution of the current web...
3
by: qfchen | last post by:
Hi In order to save data into excel file in my application, I need to define Dim excelApp As New Excel.Application but I got error message: "Type Excel.Application" is not defined. What component...
1
by: Ysa Gohh | last post by:
Hello For my project, I made a program that computes for FG (Final Grade) of a student, and lists the students who receive awards. How do I save these data? (the values of the variable FG and the...
4
by: keyvan | last post by:
i want to save picture in drive but i only want to open dialog box once at the begging and after the user can save image without open file dialog
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.