# I really need help! to make a quiz

**URL:** <https://discourse.processing.org/t/i-really-need-help-to-make-a-quiz/7431>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [January 11, 2019, 9:23pm UTC](https://discourse.processing.org/t/i-really-need-help-to-make-a-quiz/7431 "2019-01-11T21:23:37Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 12, 2019, 4:09am UTC](https://discourse.processing.org/t/i-really-need-help-to-make-a-quiz/7431/3 "2019-01-12T04:09:46Z")

</div>

i understand it might be too much,  
but just take a look to see that there are some other possible

- program structures
- ways like array…

to do that:  
( example)

```auto
String[] questions ={
  "start text", 
  "qa\n[a] bla\n[b] blb\n[c] blc", 
  "qb\n[a]\n[b]\n[c]", 
  "qc\n[a]\n[b]\n[c]", 
  "end"};
String[] goodanswers={
  "n.a.", 
  "a", 
  "c", 
  "b", 
  "n.a."};
int q=0, grade=0, gambler = 0;

void setup() {
  size (500, 500);
  println("mouse click: LEFT: next question, RIGHT: start again");
  println("key: [a],[b], ... as indicated in the questions");
}

void draw() {
  background(200, 200, 0);
  fill(0,200,200); // text color
  textSize(25);
  text(questions[q], 10, 20);
  fill(0,200,0); // text color
  textSize(15);
  if ( grade > 0 ) text("grade: "+grade+" fails: "+gambler, width - 200, height - 20);
}

void mousePressed() {
  if ( mouseButton == LEFT ) q++;
  if ( q > 4 ) exit();
  if ( mouseButton == RIGHT ) q = 0;
}

void keyPressed() {
  //println("key: "+key+" keyCode "+keyCode);
  if ( goodanswers[q].equals(str(key)) ) { 
    println("++ ha, expert");
    grade++;
    q++;
  } else { 
    println("-- bad guess, try again or skip with mouse LEFT click");
    gambler++;
  }
}

```

---

_[View the full topic](https://discourse.processing.org/t/i-really-need-help-to-make-a-quiz/7431)._
