Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
Max Starr
Max Starr's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
for loop problem
[5 Replies]
02-Jun-2013 09:48 PM
Forum:
Programming Questions
on line 24 i keep getting "unexpected token: i" error, if I put
int
before the "i" it says "expected COLON found =" please help.
thanks.
String input="";
String error="";
boolean done=false;
float a=0;
float b=0;
float c=0;
int var=1;
int i=0;
void setup(){
size(640,360);
}
void draw(){
background(256,256,256);
fill(0,0,0);
text("Input numbers:", 20, 40);
text(a+"x^2+"+b+"x+"+c, 20, 60);
text(input,110,40);
fill(256,0,0);
text(error,256,80);
if (done==true){
for(i = (-(b)/2(a))-2; i < (-(b)/2(a))+2; i++){
float[] points;
points.add(i);
}
}
}
void keyPressed(){
if((key >= '0' && key <= '9')||key == '.'){
input += key;
}else if(key == BACKSPACE){
if(input==""){
}else{
input = input.substring( 0, input.length()-1 );
}
}else if(key == ENTER){
switch (var){
case 1:
if(input.equals("")){
error = "Pleas input a number";
break;
}else{
a = Float.parseFloat(input);
input = "";
error ="";
println(a);
var++;
}
break;
case 2:
if(input.equals("")){
error = "Pleas input a number";
break;
}else{
b = Float.parseFloat(input);
input = "";
error ="";
println(b);
var++;
}
break;
case 3:
if(input.equals("")){
error = "Pleas input a number";
break;
}else{
c = Float.parseFloat(input);
input = "";
error ="";
println(c);
var++;
}
done = true;
break;
}
}
}
«Prev
Next »
Moderate user : Max Starr
Forum