#include <iostream>
#include <fstream>
int main(void)
{
/*
ifstream = read-only.
ofstream = write-only.
fstream = read+write.
*/
std::ifstream userlogf;
userlogf.open("log.txt");
if (!userlogf.is_open())
{
std::cout << "Welcome!" << std::endl;
std::ofstream userlogof;
userlogf.close();
userlogof.open("log.txt");
userlogof << "Please do not delete this file.";
userlogof.close();
userlogf.open("log.txt");
}
else if (userlogf.is_open())
{
std::cout << "Welcome back." << std::endl;
}
else
{
std::cout << "Welcome." << std::endl << "Error, can't access log file." << std::endl;
}
userlogf.close();
return 0;
}
/* -- CSS -- /*
/* Style the buttons that are used to open and close the accordion panel */
.accordion {
background-color: #222;
color: #eee;
cursor: pointer;
padding: 18px;
width: 100%;
text-align: left;
border: none;
outline: none;
transition: 0.4s;
}
/* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */
.active, .accordion:hover {
background-color: #272727;
}
/* -- JavaScript -- /*
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
/* Toggle between adding and removing the "active" class,
to highlight the button that controls the panel */
this.classList.toggle("active");
/* Toggle between hiding and showing the active panel */
var panel = this.nextElementSibling;
if (panel.style.display === "block") {
panel.style.display = "none";
} else {
panel.style.display = "block";
}
});
}
</script>