| 1 |
#include "../../String/String.h"
|
| 2 |
#include "../../String/StringInput.h"
|
| 3 |
#include "../../String/Parse.h"
|
| 4 |
#include "../../System/System.h"
|
| 5 |
#include "../../Array/IntArray.h"
|
| 6 |
#include "../../Array/FloatArray.h"
|
| 7 |
#include "ArrayTest2.h"
|
| 8 |
#include "../../System/SystemDefine.h"
|
| 9 |
|
| 10 |
|
| 11 |
ArrayTest2::ArrayTest2(){}
|
| 12 |
ArrayTest2::~ArrayTest2(){}
|
| 13 |
|
| 14 |
void ArrayTest2::run()
|
| 15 |
{
|
| 16 |
|
| 17 |
FloatArray *floatArray=new FloatArray(3);
|
| 18 |
|
| 19 |
floatArray->setFloat(2.4f,0);
|
| 20 |
floatArray->setFloat(1.3f,1);
|
| 21 |
floatArray->setFloat(3.324f,2);
|
| 22 |
|
| 23 |
String arrayInfo="FloatValue: ";
|
| 24 |
|
| 25 |
for ( int r=0; r<floatArray->size ; r++ )
|
| 26 |
{
|
| 27 |
System::println(arrayInfo + "nonSorted " + floatArray->getFloat(r));
|
| 28 |
}
|
| 29 |
|
| 30 |
floatArray->sortLargestOrder();
|
| 31 |
|
| 32 |
for ( int r2=0; r2<floatArray->size ; r2++ )
|
| 33 |
{
|
| 34 |
System::println(arrayInfo + " sorted " + floatArray->getFloat(r2));
|
| 35 |
}
|
| 36 |
|
| 37 |
|
| 38 |
delete floatArray;
|
| 39 |
|
| 40 |
|
| 41 |
FloatArray *floatArray2=new FloatArray();
|
| 42 |
|
| 43 |
floatArray2->addLast(3.3f);
|
| 44 |
floatArray2->addLast(4.2f);
|
| 45 |
floatArray2->addLast(3.2f);
|
| 46 |
|
| 47 |
String arrayInfo2="floatValue: ";
|
| 48 |
|
| 49 |
for ( int t=0; t<floatArray2->size ; t++ )
|
| 50 |
{
|
| 51 |
System::println(arrayInfo2 + "nonSorted " + floatArray2->getFloat(t));
|
| 52 |
}
|
| 53 |
|
| 54 |
floatArray2->sortSmallestOrder();
|
| 55 |
|
| 56 |
floatArray2->removeFloat(0);
|
| 57 |
floatArray2->removeFloat(0);
|
| 58 |
floatArray2->removeFloat(0);
|
| 59 |
|
| 60 |
for ( int t2=0; t2<floatArray2->size ; t2++ )
|
| 61 |
{
|
| 62 |
System::println(arrayInfo2 + " sorted " + floatArray2->getFloat(t2));
|
| 63 |
}
|
| 64 |
|
| 65 |
String blaha="blah ";
|
| 66 |
|
| 67 |
System::println(blaha + 0.01f);
|
| 68 |
|
| 69 |
delete floatArray2;
|
| 70 |
}
|