jeudi 27 juillet 2017

Clear terminal every second but leave minutes

I have a seconds and minute counter, very similar to my timer. However, I cannot get the number of minutes to stay on screen.

int main()
{
    int spam = 0;
    int minute = 0;

    while (spam != -1)
    {
        spam++;
        std::cout << spam << " seconds" << std::endl;
        Sleep(200);
        system("CLS");
        //I still want the system to clear the seconds
        if ((spam % 60) == 0)
        {
            minute++;
            std::cout << minute << " minutes" << std::endl;
        }
        //but not the minutes
    }
}

Aucun commentaire:

Enregistrer un commentaire