1. record the computer time when user click on the mouse 2. export the time to a file ( .txt) 3. update the file
#include <time.h> #include <stdio.h> #include <iostream> #include <fstream> using namespace std; int main() { //string record; char key; ofstream fout; ifstream fin; fin.open ("text.txt"); fout.open ("text1.txt"); while(1){ cin>>key; if (key=='a') {time_t currentTime = time(0); printf("The Current Time is %s", ctime(¤tTime)); fout << ctime(¤tTime); key=='0'; } if (key =='b') break; } fout.close(); system("PAUSE"); return 0; }
#include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\n"; myfile.close(); return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)