Нужна помощь в создании консольного приложения, которое выводит процент ответа для рейтинга в опросе 1-5 (целое число)

Попробуйте этот формат: -

SELECT DATE_FORMAT(NOW(),'%d-%b-%Y')

Это будет выглядеть как: -

10-Sep-2014

Надеюсь, это поможет вам.

0
задан Sean Bruce 4 March 2019 в 21:48
поделиться

1 ответ

class Program {
    static void Main(string[] args) {
        string input = "";
        List<List<int>> answers = new List<List<int>>();
        int questionsCount = ReadInt32("The number of questions: ");
        for (int i = 0; i < questionsCount; i++) {
            answers.Add(new List<int>());
        }
        while (input == "" || input == "y") {
            for (int i = 0; i < answers.Count; i++) {
                List<int> a = answers[i];
                a.Add(ReadInt32($"Question [{i}]: "));
            }
            input = Read("Continue (y/n)? ").ToLower();
        }
        WriteLine("End of input!");
        for (int i = 0; i < answers.Count; i++) {
            List<int> a = answers[i];
            Write($"Average for question[{i}]: {a.Average()}\n");
        }
        ReadKey();
    }

    static string Read (string a) {
        Write(a);
        return ReadLine();
    }

    static int ReadInt32 (string a = "") {
        Write(a);
        return ToInt32(ReadLine());
    }
}

Попробуйте это. Вы можете настроить вопросы. И обратите внимание, что для использования Write() и WriteLine(), вы должны добавить

using static System.Console;

вверху, в ссылках проекта.

0
ответ дан Vinícius Gabriel 4 March 2019 в 21:48
поделиться
Другие вопросы по тегам:

Похожие вопросы: