小编pre*_*pha的帖子

C++ 输出奇怪的字符而不是数字 (Windows)

我需要为我的教育编写一个乐透生成器,它会随机滚动数字并检查重复条目,否则替换它们。当我启动程序时没有错误消息并且程序运行但我只看到奇怪的字符而不是数字。 问题的图片

我的代码有什么问题?

#include <iostream>
#include <array>
#include <time.h>

std::array<unsigned char, 6> lottoZahlen = {0, 0, 0, 0, 0, 0};

void arrayFuellen();
unsigned char checkDuplikate(unsigned char);
void arraySortieren();

int main()
{
    arrayFuellen();
    arraySortieren();

    std::cout << "\n---- Ihre Glueckszahlen lauten: ----" << std::endl;

    for (unsigned char lottoGlueck : lottoZahlen)
    {
        std::cout << lottoGlueck << std::endl;
    }

    std::cout << "---- Glueckszahlen Ende ----" << std::endl;
}


void arrayFuellen()
{
    srand(time(NULL));

    unsigned char wuerfelZahl = 0;
    unsigned char wuerfelZahlChecked = 0;

    for …
Run Code Online (Sandbox Code Playgroud)

c++

4
推荐指数
1
解决办法
153
查看次数

标签 统计

c++ ×1