Нужен счётчик нажатий на кнопку счёт которого не будет сбрасываться при перезаходе в приложение и данные которого будут храниться на файле в компьютере
iam new in cppyou can save data in sql db or in register better than a file
Иногда ответы на бессвязный бред восполенного мозга нуба всё таки возможны, приведу пример к теме на xss ссылка тыц
Посмотреть вложение 49427
Что человеку мешало, не ловить кучу хейта, просто сделать так:
Посмотреть вложение 49428
И так:
Посмотреть вложение 49429
И получить кодес:
C++:#include <iostream> #include <fstream> using namespace std; int main() { int count = 0; // Try to open the file for reading ifstream in("count.txt"); if (in.is_open()) { // If the file exists and was successfully opened, read the count from it in >> count; in.close(); } // Increment the count every time the button is clicked count++; // Try to open the file for writing ofstream out("count.txt"); if (out.is_open()) { // If the file was successfully opened, write the updated count to it out << count; out.close(); } else { // If the file couldn't be opened, print an error message cout << "Error: Unable to open count.txt for writing." << endl; } return 0; }