C ++ CMD屏幕中间的屏幕切换输出?

时间:2014-09-12 01:21:08

标签: c++ loops cmd sleep cout

我想知道是否有人可以帮助我使用我的死亡预测计划?这将不胜感激!我很抱歉,如果这是错误的部分,我只是想知道它是否可能? 基本上我希望cmd输出屏幕始终位于中心,而不是放在屏幕的底部。它看起来不太漂亮。谢谢! (如有必要,可使用DeathPredictorV1代码)

//GOOOD LUCK
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <Windows.h>
#include <stdlib.h>
#include <time.h> 
#include <random>

using namespace std;


int main()
{
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(1, 20);

for (int n = 0; n < 10; ++n)
cout << "\n";


for (double count = 0; count < 20; count++)
{

    int var = dis(gen);

    if (count < 20 )
    {
        Sleep(360);
        cout << "\n\t\t    It's your birthday! You turned: " << count << "\t" << var;

    }
    if (var == 18)
    {
        cout << "\n\n\n\t\t\tBang! You're dead!";
        cout << "\n\n     ";
        Sleep(1000);
        cout << "T   "; Sleep(100);
        cout << "H   "; Sleep(100);
        cout << "A   "; Sleep(100);
        cout << "N   "; Sleep(100);
        cout << "K   "; Sleep(100);
        cout << "S   "; Sleep(100);
        cout << "    "; Sleep(100);
        cout << "F   "; Sleep(100);
        cout << "O   "; Sleep(100);
        cout << "R   "; Sleep(100);
        cout << "    "; Sleep(100);
        cout << "P   "; Sleep(100);
        cout << "L   "; Sleep(100);
        cout << "A   "; Sleep(100);
        cout << "Y   "; Sleep(100);
        cout << "I   "; Sleep(100);
        cout << "N   "; Sleep(100);
        cout << "G   "; Sleep(100);
        cout << "    "; Sleep(100);
        cout << "\n\n\n\t\t\t  ";
        return 0;
    }


}

cout << "\n\n\n\t\t\t  ";
}

0 个答案:

没有答案