[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pluscal Print



Hi,

Have few doubts regarding the pluscal print statement. For the purpose illustration I an using the following example:

--algorithm EuclidAlgo {
    variable u = 24; v \in 1..N;
    {
        print << u, v >>;
        while(u # 0) {
            if(u < v) { u := v || v := u };
            u := u-v;
        };
        print <<" Have GCD = ", v >>;
    }
}

While setting the value of N = 10, I got the following output 

<<24, 1>>
<<24, 3>>
<<24, 4>>
<<24, 5>>
<<24, 2>>
<<24, 6>>
<<24, 7>>
<<24, 8>>
<<24, 9>>
<<24, 10>>
<<" Have GCD = ", 8>>
<<" Have GCD = ", 6>>
<<" Have GCD = ", 3>>
<<" Have GCD = ", 4>>
<<" Have GCD = ", 2>>
<<" Have GCD = ", 1>>

I have two questions:
1) Sequence in which the two print statement works. Not able to match the input to the output. Moreover there is a mismatch in the number of input's, i.e <<u, v>> and expected output <<" Have GCD = ", v>>.
2) In case of second print statement, quotes used to represent a string were also printed on the console.

please clarify.

Regards,
Piyush