#include <iostream>
#include <cstdlib>
#include <string>
#include <thread>  // Required for the sleep function
#include <chrono>  // Required for time units (seconds, milliseconds, etc.)

int main() {
    int n;
        int delaySeconds;
            std::string command;

                // 1. Get the command
                    std::cout << "Enter the command you want to run: ";
                        std::getline(std::cin, command);

                            // 2. Get the number of loops
                                std::cout << "How many times should it run? ";
                                    std::cin >> n;

                                        // 3. Get the delay
                                            std::cout << "How many seconds to wait between each run? ";
                                                std::cin >> delaySeconds;

                                                    std::cout << "\n--- Executing Command ---\n";

                                                        // 4. Loop with Sleep
                                                            for (int i = 0; i < n; ++i) {
                                                                    std::system(command.c_str());

                                                                                    // This is the C++ sleep command
                                                                                            std::this_thread::sleep_for(std::chrono::seconds(delaySeconds));
                                                                                                }

                                                                                                    std::cout << "\n--- Finished ---\n";

                                                                                                        return 0;
                                                                                                        }
