Cin和Cout测验无法完成

时间:2018-02-06 05:36:27

标签: c++ cin cout

我尝试使用coutcin的功能进行基本测验,我被困在这里:

#include <iostream>
using namespace std;

char askQuestion (int questionNumber, char* question, char* optionA, char* optionB, char* optionC) {
    char answer;
    cout << questionNumber << ".)" << question << "\n";
    cout << optionA << "\n";
    cout << optionB << "\n";
    cout << optionC << "\n";
    cin >> answer;
    return answer;
}
int main()
{
    char answer1;
    char answer2;
    char questionNumber;

    questionNumber = 1;
    answer1 = askQuestion(questionNumber, "Who is the Big Red Dog?", "A.)Milo", "B.)Clifford", "C.)Jack");

    return 0;
}

1 个答案:

答案 0 :(得分:0)

您的意思是输出答案吗?...

<?php namespace Author\MyPlugin\Classes\Translation;


class Message extends \RainLab\Translate\Models\Message
{
    /**
     * Creates or finds an untranslated message string.
     * @param  string $messageId
     * @return string
     */
    public static function get($messageId)
    {
        if (!self::$locale) {
            return $messageId;
        }

        if (!is_string($messageId)) {
            return null;
        }

        // we let full translation key for the backend
        if (!\App::runningInBackend()) {
            $messageCode = self::makeMessageCode($messageId);
        } else {
            $messageCode = $messageId;
        }

        /*
        * Found in cache
        */
        if (array_key_exists($messageCode, self::$cache)) {
            return self::$cache[$messageCode];
        }

        /*
         * Uncached item
         */
        $item = static::firstOrNew([
            'code' => $messageCode
        ]);

        /*
         * Create a default entry
         */
        if (!$item->exists) {
            $data = [static::DEFAULT_LOCALE => $messageId];
            $item->message_data = $item->message_data ?: $data;
        }

        /*
         * Schedule new cache and go
         */
        $msg = $item->forLocale(self::$locale, $messageId);
        self::$cache[$messageCode] = $msg;
        self::$hasNew = true;

        return $msg;
    }
}