Using Integers in an if statement. Help please.
in
Programming Questions
•
1 year ago
I am making a random Shakespearian Insult Genorator and I am just making finishing touches to specify grammar differences in the first line. I want it to change from "an" to "a" according to words that start with vowels. Here is my code:
- void setup() {
- size(400, 300);
- stroke(0);
- smooth();
- textAlign(CENTER);
- }
- int a, a2, n;
- String[] adjectives = {
- "artless", "beslubbering", "bootless", "churlish", "cockered", "clouted", "craven", "currish", "dankish", "dissembling", "droning",
- "errant", "fawning", "fobbing", "froward", "frothy", "gleeking", "goatish", "gorbellied", "impertinent", "infectious", "jarring",
- "loggerheaded", "lumpish", "mammering", "mangled", "mewling", "paunchy", "pribbling", "puking", "puny", "quailing", "rank", "reeky",
- "roguish", "ruttish", "saucy", "spleeny", "spongy", "surly", "tottering", "unmuzzled", "vain", "venomed", "villanious", "warped",
- "wayward"
- };
- String[] adjectives2 = {
- "base-court", "bat-fowling", "beef-wited", "beetle-headed", "boil-brained", "clapper-clawed", "clay-brained", "common-kissing",
- "crook-pated", "dismal-dreaming", "dizzy-eyed", "doghearted", "dread-bolted", "earth-vexing", "elf-skinned", "fat-kidneyed",
- "fen-sucked", "flap-mouthed", "fly-bitten", "folly-fallen", "fool-born", "full-gorged", "guts-griping", "half-faced", "hasty-witted",
- "hedge-born", "hell-hated", "idle-headed", "ill-breeding", "ill-nurtured", "knotty-pated", "milk-livered", "motley-minded",
- "onion-eyed", "plume-plucked", "pottle-deep", "pox-marked", "reeling-ripe", "rough-hewn", "rude-growing", "rump-fed", "shard-borne",
- "sheep-biting", "spur-galled", "swag-bellied", "tardy-gaited", "tickle-brained", "toad-spotted"
- };
- String[] nouns = {
- "apple-john", "baggage", "barnacle", "bladder", "boar-pig", "bugbear", "burn-bailey", "canker-blossom", "clack-dish", "clotpole", "coxcomb",
- "codpiece", "death-token", "dewberry", "flap-dragon", "flax-wench", "flirt-gill", "foot-licker", "fustilarian", "giglet", "gudgeon",
- "haggard", "harpy", "hedge-pig", "horn-beast", "hugger-mugger", "jolthead", "lewduster", "lout", "maggot-pie", "malt-worm", "mammet",
- "measle", "minnow", "miscreant", "moldwarp", "mumble-news", "nut-hook", "pigeon-egg", "pignut", "puttock", "pumpion", "ratsbane", "scut",
- "skainsmate", "strumpet", "varlot", "vassal"
- };
- void draw() {
- background(255);
- fill(0);
- textSize(40);
- vowels();
- text(adjectives[a], width/2, height/3+50);
- text(adjectives[a2], width/2, height/2+50);
- text(nouns[n], width/2, height*2/3+50);
- fill(50, 255, 50);
- rect(0, 0, 75, 25);
- textSize(13);
- fill(0);
- text("New Insult", 75/2, 25/2+4);
- if (mouseX < 75 && mouseY < 25) {
- strokeWeight(3);
- cursor(HAND);
- }
- else {
- strokeWeight(1);
- cursor(ARROW);
- }
- }
- void mousePressed() {
- if (mouseX < 75 && mouseY < 25) {
- a = int(random(47));
- a2 = int(random(47));
- n = int(random(47));
- }
- }
- void vowels() {
- if (a == 0 || 12 || 20 || 21 || 42) {
- text("You are an...", width/2, height/3);
- } else {
- text("You are a...", width/2, height/3);
- }
- }
After I test the program I get an error saying "The operator || is undefined for the argument types int." How can I fix this problem and still have the program work the way I would like it to?
Thanks!
Grayson
1