Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread Waseem Shahzad

thanx for ur help.

On 4/24/07, Sherif Elshazly <[EMAIL PROTECTED]> wrote:


Could be irrelevant or could be useful so I'll mention it anyway.

That looks fine to me, but i would create a new variable to hold the value
of arr.length to test against, it'll be more efficient to access a
variable than an array's property.

var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
var loopCount:Number = arr.length;
for(var i:Number = 0; i < loopCount; i++){
   greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Sherif

- Original Message 
From: Gilles Roquefeuil <[EMAIL PROTECTED]>
To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, April 24, 2007 11:51:18 AM
Subject: Re: [Flashcoders] there is a problem plz help


Hello,


is this better ?

var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
for(var i:Number = 0; i < arr.length; i++){
   greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Gilles
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread Waseem Shahzad

Thanx Nice solution.

On 4/24/07, opto-type <[EMAIL PROTECTED]> wrote:


And what about that ?

var arr:Array = [17, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
arr.sort(16);
trace(arr[arr.length-1]);

Patrick




2007/4/24, Sherif Elshazly <[EMAIL PROTECTED]>:
>
> Could be irrelevant or could be useful so I'll mention it anyway.
>
> That looks fine to me, but i would create a new variable to hold the
value
> of arr.length to test against, it'll be more efficient to access a
> variable than an array's property.
>
> var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
> var greater:Number = 0;
> var loopCount:Number = arr.length;
> for(var i:Number = 0; i < loopCount; i++){
> greater = Math.max(greater,arr[i]);
> }
> trace("greater is " + greater + "\n");
>
> Sherif
>
> - Original Message 
> From: Gilles Roquefeuil <[EMAIL PROTECTED]>
> To: flashcoders@chattyfig.figleaf.com
> Sent: Tuesday, April 24, 2007 11:51:18 AM
> Subject: Re: [Flashcoders] there is a problem plz help
>
>
> Hello,
>
>
> is this better ?
>
> var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
> var greater:Number = 0;
> for(var i:Number = 0; i < arr.length; i++){
> greater = Math.max(greater,arr[i]);
> }
> trace("greater is " + greater + "\n");
>
> Gilles
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread opto-type

And what about that ?

var arr:Array = [17, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
arr.sort(16);
trace(arr[arr.length-1]);

Patrick




2007/4/24, Sherif Elshazly <[EMAIL PROTECTED]>:


Could be irrelevant or could be useful so I'll mention it anyway.

That looks fine to me, but i would create a new variable to hold the value
of arr.length to test against, it'll be more efficient to access a
variable than an array's property.

var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
var loopCount:Number = arr.length;
for(var i:Number = 0; i < loopCount; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Sherif

- Original Message 
From: Gilles Roquefeuil <[EMAIL PROTECTED]>
To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, April 24, 2007 11:51:18 AM
Subject: Re: [Flashcoders] there is a problem plz help


Hello,


is this better ?

var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
for(var i:Number = 0; i < arr.length; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Gilles
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread Sherif Elshazly
Could be irrelevant or could be useful so I'll mention it anyway.

That looks fine to me, but i would create a new variable to hold the value of 
arr.length to test against, it'll be more efficient to access a variable than 
an array's property.
 
var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
var loopCount:Number = arr.length;
for(var i:Number = 0; i < loopCount; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Sherif

- Original Message 
From: Gilles Roquefeuil <[EMAIL PROTECTED]>
To: flashcoders@chattyfig.figleaf.com
Sent: Tuesday, April 24, 2007 11:51:18 AM
Subject: Re: [Flashcoders] there is a problem plz help


Hello,


is this better ?

var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
for(var i:Number = 0; i < arr.length; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Gilles
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread Gilles Roquefeuil

Hello,


is this better ?

var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
for(var i:Number = 0; i < arr.length; i++){
greater = Math.max(greater,arr[i]);
}
trace("greater is " + greater + "\n");

Gilles
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread Claus Wahlers



to find greater no. from the array whats the problem with this algo.
please help



int arr[15]={17,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int greater=0;
for(int i=0; i<15;){
 if(arr[i++]>greater){
  greater=arr[i];
 }
}


First of all, it's C.

Second, try incrementing i inside the for statement, otherwise the 
algorithm reports the wrong value:

for(int i=0; i<15; i++)

The Actionscript equivalent would be something like this:
var arr:Array = [17,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var greater:Number = 0;
for(var i:Number = 0; i < arr.length; i++){
if(arr[i] > greater) {
greater = arr[i];
}
}
trace("greater is " + greater + "\n");

Cheers,
Claus.

--
claus wahlers
cĂ´deazur brasil
http://codeazur.com.br/
http://wahlers.com.br/claus/blog/
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] there is a problem plz help

2007-04-24 Thread Petrus Rademeyer

you check if the arr[i] is greater than greater and then you increment i
rather do

for(int i=0; i<15;i++){

if(arr[i]>greater){
 greater=arr[i];
 }

}

:)

Waseem Shahzad wrote:

/*

to find greater no. from the array whats the problem with this algo.

 please help


 */



#include


void main(){

int arr[15]={17,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

int greater=0;

for(int i=0; i<15;){

 if(arr[i++]>greater){
  greater=arr[i];

 }

}

cout<<"greater is "

[Flashcoders] there is a problem plz help

2007-04-24 Thread Waseem Shahzad

/*

to find greater no. from the array whats the problem with this algo.

 please help


 */



#include


void main(){

int arr[15]={17,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

int greater=0;

for(int i=0; i<15;){

 if(arr[i++]>greater){
  greater=arr[i];

 }

}

cout<<"greater is "