Write a program that multiplies three numbers together and prints the results to the screen. Do this for 5 sets of numbers. Use a function that returns the product of the three numbers to do this.
You may have a line like this in your code:
text(myFunc(3, 4, 5), 50, 50);
If myFunc uses a return statement and returns the product of 3*4*5, then that product will be printed to the screen at coordinates (50,50).
Here's what I have:
PFont font;
- void setup()
- {
- size(500,500);
- background(255,255,255);
- font = loadFont("Calibri-34.vlw");
- textFont(font, 32);
- }
- void multiplication(int x, int y, int z)
- {
- x*y*z;
- return(multiplication);
- }
- void draw()
- {
- fill(0,0,0);
- text(multiplication(3,4,5),10,50);
- text(multiplication(4,5,6),50,50);
- text(multiplication(7,8,9),90,50);
- text(multiplication(10,11,12),130,50);
- text(multiplication(13,14,15),170,50);
- }
I'm getting "Syntax error on token "*", invalid AssignmentOperator.
I'm obviously writing something incorrectly,but I can't figure out how to fix it. Any help would be appreciated. I just need to know how to make a valid multiplication function in void multiplication so I can plug in my variables in the draw section. Thanks in advance.