0
package hw3;
import java.math.*;

public class Main {

    public static void main(String[] args) {
        int i, j=0;
        double t=0;

//input
        int m=4;
        int n=5;

        hw3.Point[] p = new Point[m];
        hw3.Point[] q = new Point[n];
        p[0] = new Point(0,0);
        p[1] = new Point(0,1);
        p[2] = new Point(0,3);
        p[3] = new Point(0,5);
        q[0] = new Point(1,1);
        q[1] = new Point(1,4);
        q[2] = new Point(1,5);
        q[3] = new Point(1,6);
        q[4] = new Point(1,7);

    int l=m+n-2;
    hw3.Line[] ln = new Line[l];
    ln[0] = new Line(p[0],q[0]);
        for (int lncount=1; i<=m && j<=n;lncount++)

--------------------------------------------------------
This is the part of Main class and only one error had occured.
The letter 'i' at 'i<=m'. Just that tiny one letter and it's says it can't run because of that. All other things are fine.
Could you please tell me what the problem is??

Edited by Reverend Jim: Fixed formatting

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by annietabio
0

Hi annietabio and welcome to DaniWeb :)

int i, j=0;

All you have done here is tell the compiler that you have an int called i, you haven't given it a value. When you say i<=m, the compiler doesn't know whether this is true, because i could be 0 or 100000 or -56. You need to initialize it to a value.

Edited by darkagn: Added welcome

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.