all! I'm trying to find the best way to accept user input, timestamp it, then place it into a file with correct formatting (One timestamp/input per line. What is the best way to timestamp then give over to put it all in a file? Thanks!
Heres my barebones code as an example:
#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
using namespace std;
//void passwordCheck()
//{
//
//}
string timestamp(string passwordInput1, string passwordInput2, string passwordInput3, string passwordInput4, string passwordInput5, string passwordInput6, string passwordInput7, string passwordInput8, string passwordInput9, string passwordInput10)
{
time_t now = time(0);
char* dt = ctime(&now);
cout << "The local date and time is: " << dt << endl;
tm *gmtm = gmtime_s(&now);
dt = asctime(gmtm);
}
//void saveToFile()
//{
//
//cout << "I've saved 10 passwords for you." << endl;
//}
int main()
{
ofstream outputToFile;
outputToFile.open("manageMyPasswords.txt");
// Look for easier/cleaner way to do this.
string passwordInput1, passwordInput2, passwordInput3, passwordInput4, passwordInput5, passwordInput6, passwordInput7, passwordInput8, passwordInput9, passwordInput10;
// Put into a function then call back here.
cout << "Welcome to Password Manager!" << endl;
cout << " Enter your first password" << endl;
getline (cin, passwordInput1);
cout << "Enter the next password." << endl;
getline (cin, passwordInput2);
cout << "Enter the next password." << endl;
getline (cin, passwordInput3);
cout << "Enter the next password." << endl;
getline (cin, passwordInput4);
cout << "Enter the next password." << endl;
getline (cin, passwordInput5);
cout << "Enter the next password." << endl;
getline (cin, passwordInput7);
cout << "Enter the next password." << endl;
getline (cin, passwordInput8);
cout << "Enter the next password." << endl;
getline (cin, passwordInput9);
cout << "Enter the next password." << endl;
getline (cin, passwordInput10);
//void saveToFile();
system("pause");
return 0;
}