[nfbcs] trouble creating database for Trivia game
Jessica Dail
jldail13 at gmail.com
Sat Mar 18 14:16:31 UTC 2017
Hi,Right now, my questions are in a file. How can I tell my program to read from this file? What do I need to do in order to fix my errors?
Sent from my iPhone
> On Mar 18, 2017, at 8:52 AM, Chris Nestrud via nfbcs <nfbcs at nfbnet.org> wrote:
>
> You could investigate SQLite.
>
> https://system.data.sqlite.org/
>
> Chris
>
>> On Fri, Mar 17, 2017 at 10:34:01PM -0400, Jessica D via nfbcs wrote:
>> 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
>>
>> _______________________________________________
>> nfbcs mailing list
>> nfbcs at nfbnet.org
>> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
>> To unsubscribe, change your list options or get your account info for nfbcs:
>> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/ccn%40chrisnestrud.com
>
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/jldail13%40gmail.com
More information about the NFBCS
mailing list