[nfbcs] trouble creating database for Trivia game

jldail13 at gmail.com jldail13 at gmail.com
Sat Mar 18 02:34:01 UTC 2017


Hi,
I’m making a trivia game.
I’d like to make a database of questions and answers so I don’t have to hand code them.

Can anyone tell me how ot do this?
		


Here is my source code.


using System;
using System.Collections.Generic;
using System.IO;
namespace Trivia_game
{
    partial class Hello
    {

        static void Main()
        {
            string intro;
            string Value;
            Value = Console.ReadLine();
            string line;
            line = Console.ReadLine();

            Console.WriteLine("Hello, lets start enter the value from the file that will best answer the question");
            intro =("Welcome to "QuizMasters. Inthis game, you'll answer a series of questions. the rules are simple. answer a question correctly and earn points, answer incorrectly and you'll lose everything.)"Console.ReadLine();

            StreamReader file = new StreamReader("Trivia game questions.txt");
            while ((line = file.ReadLine()) != null)
            {
                Console.WriteLine(line);
                Console.ReadLine();
            } }

        var questions = new List<Question>();

// Open file containing quiz questions using StreamReader, which allows you to read text from files easily.

    string line;
    Question question;

    // Loop through the lines of the file until there are no more (the ReadLine function return null at this point).
    // Note that the ReadLine called here only reads question texts (first line of a question), while other calls to ReadLine read the choices.
                break;
public object Questions { get => Questions1; set => Questions1 = value; }
        public object Questions1 { get => Questions2; set => Questions2 = value; }
        public object Questions2 { get => Questions3; set => Questions3 = value; }
        public object Questions3 { get => Questions4; set => Questions4 = value; }
        public object Questions4 { get => questions; set => questions = value; }
    }
        }
    
        // Check if none of the choices was marked as correct. If this is the case, we throw an exception and then stop processing.


Thanks,
Jessica

Thanks,
Jessica




More information about the NFBCS mailing list