Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Want to write a simple program

Name: Anonymous 2013-01-12 11:15

What I want to do is make a simple revision tool, which will throw out a word/phrase to which the response needs to be whatever words/phrases it has in common with it, then finally showing a rating of how many correct things were entered in total.
So like for example, it'd display 'Battles during such and such war', and then you'd type in whatever you remembered and get a response. I assume it'd be a good help to just prepare the program with writing the questions and possible answers, but obviously it'd be nice to have functionality as a quizzing tool.
I hope this makes sense, I'm very, very tired and I keep laughing to myself for little reason in my corner of the library.

Name: Anonymous 2013-01-12 11:45


var questions = [
  {  question: "Battles during _______ war: Đức Cơ, Tet Offensive"
     answer: "Korean"
  },
  {  question: "Inventor of computer science"
     answer: "Ada Lovelace"
  }
  /* ... */
];
alert("Your score: " +
  questions.reduce(function(score, q) {
    var correct = prompt(q.question) === q.answer;
    alert(correct ? "Correct" : "Wrong");
    return score + (correct ? 1 : 0);
  }, 0));

Name: Anonymous 2013-01-12 13:46

>>2
AIDS

I think you mean.

#include <stdio.h>

int main()
{
  printf("What happened at the time of the thing that happened?\n");
  getchar;
  printf("WRONG.\n0 POINTS.\n");
  return 0;
}

Name: Anonymous 2013-01-13 8:18

I enjoyed this thread, largely because it's short.

Name: Anonymous 2013-01-13 16:32

>>3
getchar;
Please tell me there isn't a GCC extension that allows this.

Name: Anonymous 2013-01-13 16:34

>>3
clearly you forgot to fflush(stdin);, ``friend''.

Name: Anonymous 2013-01-13 23:56

>>5
#define getchar getchar()

Name: Anonymous 2013-01-14 0:06

>>6
fflush is undefined on input streams.

Name: Anonymous 2013-01-14 1:04

>>8
You should be using GNU C then.

Name: Anonymous 2013-01-14 2:42

>>9
gnu is shit

Name: Anonymous 2013-01-14 8:44

>>10
GNU's Not Useful!

Name: Anonymous 2013-01-14 9:50

>>8
fflush my anus!

Name: Anonymous 2013-01-14 11:56

>>3 here.

This code is GPL and therefore if you have viewed it, all of your projects now come under the GPL. Thanks for submitting a patch, >>7! I've added you to the README as a maintainer.

Don't change these.
Name: Email:
Entire Thread Thread List