C++ C++;控制台应用程序,输出不正确的数据

C++ C++;控制台应用程序,输出不正确的数据,c++,output,visual-studio-2017,pseudocode,C++,Output,Visual Studio 2017,Pseudocode,我一直在开发一个简单的控制台应用程序,当我编译最新代码时,它开始输出与我输入的内容不匹配的文本字符串和整数时,我就停止了工作 到目前为止,该程序的目的很简单:输入一个数据字符串,并在控制台应用程序中多次正确输出。下面我链接了伪代码 提前谢谢 #include <iostream> #include <string> void printIntro(); void RunApp(); bool RequestRestart(); std::string GetAtte

我一直在开发一个简单的控制台应用程序,当我编译最新代码时,它开始输出与我输入的内容不匹配的文本字符串和整数时,我就停止了工作

到目前为止,该程序的目的很简单:输入一个数据字符串,并在控制台应用程序中多次正确输出。下面我链接了伪代码

提前谢谢

#include <iostream>
#include <string>

void printIntro();
void RunApp();
bool RequestRestart();

std::string GetAttempt();

int main() // entry point of the application 
{
    printIntro();
    RunApp();
    RequestRestart();

    return 0;
}

void printIntro() {

    // introduce the program
    constexpr int WORD_LENGTH = 8; // constant expression

    std::cout << "Welcome to the Bull and Cow guessing game\n";
    std::cout << "Can you guess the " << WORD_LENGTH;
    std::cout << " letter isogram I am thinking of?\n\n";

    return;
}

void RunApp()
{
    // loop for number of attempts
    constexpr int ATTEMPTS = 5;
    for (int count = 1; count <= ATTEMPTS; count++)
    {
        std::string Attempt = GetAttempt();

        std::cout << "You have entered " << GetAttempt << "\n";
        std::cout << std::endl;
    }
}

std::string GetAttempt() 
{
    // receive input by player
    std::cout << "Enter your guess: \n";
    std::string InputAttempt = "";
    std::getline(std::cin, InputAttempt);

    return InputAttempt;
}

bool RequestRestart() 
{
    std::cout << "Would you like to play again?\n";
    std::string Response = "";
    std::getline(std::cin, Response);

    std::cout << "Is it y?: \n" << (Response[0] == 'y'); //response must be in brackets

    return false;
}
#包括
#包括
void printIntro();
void RunApp();
bool RequestRestart();
std::string gettrunt();
int main()//应用程序的入口点
{
printIntro();
RunApp();
RequestRestart();
返回0;
}
void printIntro(){
//介绍节目
constexpr int WORD_LENGTH=8;//常量表达式

std::cout您正在打印指向
gettrunt
的指针。而不是打印
trunt
:-

std::cout << "You have entered " << Attempt << "\n";

std::cout您必须更改此行

std::cot Welcome to stackoverflow.com。请花点时间阅读,尤其是名为and的部分。还有请和。最后,请学习如何创建。直接发布代码,而不是发布代码图片。我已经直接发布了我的伪代码。您是否应该打印指向函数
gettrunt
的指针它是否已经返回(并且存储在
trunt
变量中)?它应该输出用户输入到控制台的任何内容