mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
changed svn layout
git-svn-id: svn://ultimatepp.org/upp/trunk@281 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
commit
263ff5f895
2665 changed files with 642923 additions and 0 deletions
48
tutorial/Ntl07/Ntl07.cpp
Normal file
48
tutorial/Ntl07/Ntl07.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct Number {
|
||||
virtual double Get() const = 0;
|
||||
|
||||
String ToString() const { return AsString(Get()); }
|
||||
};
|
||||
|
||||
struct Integer : public Number {
|
||||
int n;
|
||||
virtual double Get() const { return n; }
|
||||
|
||||
Integer(int n) : n(n) {}
|
||||
};
|
||||
|
||||
struct Double : public Number {
|
||||
double n;
|
||||
virtual double Get() const { return n; }
|
||||
|
||||
Double(double n) : n(n) {}
|
||||
};
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
BiVector<int> n;
|
||||
n.AddHead(1);
|
||||
n.AddTail(2);
|
||||
n.AddHead(3);
|
||||
n.AddTail(4);
|
||||
DUMPC(n);
|
||||
|
||||
n.DropHead();
|
||||
DUMPC(n);
|
||||
|
||||
n.DropTail();
|
||||
DUMPC(n);
|
||||
|
||||
BiArray<Number> num;
|
||||
num.AddHead(new Integer(3));
|
||||
num.AddTail(new Double(15.5));
|
||||
num.AddHead(new Double(2.23));
|
||||
num.AddTail(new Integer(2));
|
||||
num.AddHead(new Integer(20));
|
||||
num.AddTail(new Double(-2.333));
|
||||
DUMPC(num);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue