Builder.cz - Informacni server o programovani

Odběr fotomagazínu

Fotografický magazín "iZIN IDIF" každý týden ve Vašem e-mailu.
Co nového ve světě fotografie!

 

Zadejte Vaši e-mailovou adresu:

Kamarád fotí rád?

Přihlas ho k odběru fotomagazínu!

 

Zadejte e-mailovou adresu kamaráda:

Soutěž

Sponzorem soutěže je:

IDIF

 

Kde se koná výstava fotografií Luďka Vojtěchovského?

V dnešní soutěži hrajeme o:



Rozbité formátování

Seznam témat     Nová odpověď

Přihlásit se     Registrace     Zapomenuté heslo

Re: Test smajliku

Autor: tcesky

16:15:59 12.04.2005

[size=12px][code]
[color=#008000]#include "ChlupMain.h"[/color]
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
#pragma package[color=#000000]([/color]smart_init[color=#000000])[/color]
#pragma resource "*.dfm"
TForm1 *Form1;
[color=#800000]class[/color] TChlup
{ [color=#800000]public[/color][color=#000000]:[/color]
[color=#800000]bool[/color] Positive;
[color=#800000]AnsiString[/color] Data; [color=#C0C0C0]// digits from lower to higher order[/color]
TChlup[color=#000000]([/color][color=#800000]bool[/color] pos=[color=#800000]true[/color][color=#000000])[/color][color=#000000]:[/color]Positive[color=#000000]([/color]pos[color=#000000])[/color]{}
TChlup[color=#000000]([/color][color=#800000]AnsiString[/color] val[color=#000000])[/color][color=#000000]:[/color]Data[color=#000000]([/color]val.Trim[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color],Positive[color=#000000]([/color][color=#800000]true[/color][color=#000000])[/color]
{ [color=#800000]if[/color][color=#000000]([/color]Data.SubString[color=#000000]([/color]1,1[color=#000000])[/color]=='+'[color=#000000])[/color]Data=Data.SubString[color=#000000]([/color]2,Data.Length[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]else[/color]
[color=#800000]if[/color][color=#000000]([/color]Data.SubString[color=#000000]([/color]1,1[color=#000000])[/color]=='-'[color=#000000])[/color]
{ Data=Data.SubString[color=#000000]([/color]2,Data.Length[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
Positive=[color=#800000]false[/color];
}
strrev[color=#000000]([/color]Data.c_str[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
}
TChlup[color=#000000]([/color][color=#800000]const[/color] TChlup [color=#000000]&[/color]c[color=#000000])[/color][color=#000000]:[/color]Data[color=#000000]([/color]c.Data[color=#000000])[/color],Positive[color=#000000]([/color]c.Positive[color=#000000])[/color]{}
[color=#800000]AnsiString[/color] Value[color=#000000]([/color][color=#000000])[/color]
{ [color=#800000]AnsiString[/color] str[color=#000000]([/color]Data[color=#000000])[/color];
[color=#800000]if[/color][color=#000000]([/color]str.Length[color=#000000]([/color][color=#000000])[/color]<1[color=#000000])[/color]str="0";
strrev[color=#000000]([/color]str.c_str[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]if[/color][color=#000000]([/color]!Positive[color=#000000])[/color]str="-"+str;
[color=#800000]return[/color] str;
}
[color=#800000]bool[/color] [color=#800000]operator[/color] < [color=#000000]([/color][color=#800000]const[/color] TChlup [color=#000000]&[/color]a[color=#000000])[/color][color=#800000]const[/color]
{ [color=#800000]if[/color][color=#000000]([/color]!Positive [color=#000000]&[/color][color=#000000]&[/color] a.Positive[color=#000000])[/color][color=#800000]return[/color] [color=#800000]true[/color];
[color=#800000]if[/color][color=#000000]([/color]Positive [color=#000000]&[/color][color=#000000]&[/color] !a.Positive[color=#000000])[/color][color=#800000]return[/color] [color=#800000]false[/color];
[color=#800000]int[/color] l1[color=#000000]([/color]Data.Length[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color], l2[color=#000000]([/color]a.Data.Length[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]int[/color] ret[color=#000000]([/color]l1-l2[color=#000000])[/color];
[color=#800000]if[/color][color=#000000]([/color]ret==0[color=#000000])[/color]
[color=#800000]if[/color][color=#000000]([/color]l1 > 0[color=#000000])[/color]
ret=Data[l1]-a.Data[l2];
[color=#800000]if[/color][color=#000000]([/color]!Positive [color=#000000]&[/color][color=#000000]&[/color] !a.Positive[color=#000000])[/color]ret*=-1;
[color=#800000]return[/color] ret < 0;
}
TChlup Abs[color=#000000]([/color][color=#000000])[/color][color=#800000]const[/color]{ TChlup c[color=#000000]([/color]*[color=#800000]this[/color][color=#000000])[/color]; c.Positive=[color=#800000]true[/color]; [color=#800000]return[/color] c;}
TChlup [color=#800000]friend[/color] [color=#800000]operator[/color] +[color=#000000]([/color][color=#800000]const[/color] TChlup [color=#000000]&[/color]a, [color=#800000]const[/color] TChlup [color=#000000]&[/color]b[color=#000000])[/color]
{ [color=#800000]if[/color][color=#000000]([/color] a.Positive [color=#000000]&[/color][color=#000000]&[/color] b.Positive[color=#000000])[/color][color=#800000]return[/color] TChlup[color=#000000]:[/color][color=#000000]:[/color]AbsAdd[color=#000000]([/color]a,b,[color=#800000]true[/color][color=#000000])[/color];
[color=#800000]if[/color][color=#000000]([/color]!a.Positive [color=#000000]&[/color][color=#000000]&[/color] !b.Positive[color=#000000])[/color][color=#800000]return[/color] TChlup[color=#000000]:[/color][color=#000000]:[/color]AbsAdd[color=#000000]([/color]a,b,[color=#800000]false[/color][color=#000000])[/color];
[color=#800000]if[/color][color=#000000]([/color] a.Positive [color=#000000]&[/color][color=#000000]&[/color] !b.Positive[color=#000000])[/color][color=#800000]return[/color] TChlup[color=#000000]:[/color][color=#000000]:[/color]AbsSub[color=#000000]([/color]a.Abs[color=#000000]([/color][color=#000000])[/color],b.Abs[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]if[/color][color=#000000]([/color]!a.Positive [color=#000000]&[/color][color=#000000]&[/color] b.Positive[color=#000000])[/color][color=#800000]return[/color] TChlup[color=#000000]:[/color][color=#000000]:[/color]AbsSub[color=#000000]([/color]b.Abs[color=#000000]([/color][color=#000000])[/color],a.Abs[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]return[/color] TChlup[color=#000000]([/color][color=#000000])[/color];
}
[color=#800000]static[/color] TChlup AbsAdd[color=#000000]([/color][color=#800000]const[/color] TChlup [color=#000000]&[/color]A, [color=#800000]const[/color] TChlup [color=#000000]&[/color]B, [color=#800000]bool[/color] Positive[color=#000000])[/color]
{ TChlup c[color=#000000]([/color]Positive[color=#000000])[/color];
[color=#800000]const[/color] [color=#800000]char[/color] *a[color=#000000]([/color]A.Data.c_str[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color], *b[color=#000000]([/color]B.Data.c_str[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]int[/color] carry[color=#000000]([/color]0[color=#000000])[/color];
[color=#800000]for[/color][color=#000000]([/color];*a [color=#000000]&[/color][color=#000000]&[/color] *b;a++,b++[color=#000000])[/color]
{ [color=#800000]int[/color] s=[color=#000000]([/color]*a-'0'[color=#000000])[/color] + [color=#000000]([/color]*b-'0'[color=#000000])[/color]+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color][color=#000000]([/color]'0'+s%10[color=#000000])[/color];
}
[color=#800000]if[/color][color=#000000]([/color]*a==0[color=#000000])[/color]a=b;
[color=#800000]for[/color][color=#000000]([/color];*a;a++[color=#000000])[/color]
{ [color=#800000]int[/color] s=[color=#000000]([/color]*a-'0'[color=#000000])[/color]+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color][color=#000000]([/color]'0'+s%10[color=#000000])[/color];
}
[color=#800000]if[/color][color=#000000]([/color]carry[color=#000000])[/color]c.Data+=[color=#800000]char[/color][color=#000000]([/color]'0'+carry[color=#000000])[/color];
[color=#800000]return[/color] c;
}
[color=#800000]static[/color] TChlup AbsSub[color=#000000]([/color][color=#800000]const[/color] TChlup [color=#000000]&[/color]A, [color=#800000]const[/color] TChlup [color=#000000]&[/color]B[color=#000000])[/color]
{ TChlup c;
[color=#800000]if[/color][color=#000000]([/color]A < B[color=#000000])[/color]
{ c=AbsSub[color=#000000]([/color]B, A[color=#000000])[/color];
c.Positive=[color=#800000]false[/color];
[color=#800000]return[/color] c;
}
[color=#800000]const[/color] [color=#800000]char[/color] *a[color=#000000]([/color]A.Data.c_str[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color], *b[color=#000000]([/color]B.Data.c_str[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
[color=#800000]int[/color] carry[color=#000000]([/color]0[color=#000000])[/color];
[color=#800000]for[/color][color=#000000]([/color];*a [color=#000000]&[/color][color=#000000]&[/color] *b;a++,b++[color=#000000])[/color]
{ [color=#800000]int[/color] s=10+[color=#000000]([/color]*a-'0'[color=#000000])[/color] - [color=#000000]([/color]*b-'0'[color=#000000])[/color]-carry;
[color=#800000]if[/color][color=#000000]([/color]s >=10[color=#000000])[/color]{ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color][color=#000000]([/color]'0'+s%10[color=#000000])[/color];
}
[color=#800000]for[/color][color=#000000]([/color];*a;a++[color=#000000])[/color]
{ [color=#800000]int[/color] s=[color=#000000]([/color]*a-'0'[color=#000000])[/color]-carry;
[color=#800000]if[/color][color=#000000]([/color]s >=10[color=#000000])[/color]{ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color][color=#000000]([/color]'0'+s%10[color=#000000])[/color];
}
[color=#800000]return[/color] c;
}
};
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
__fastcall TForm1[color=#000000]:[/color][color=#000000]:[/color]TForm1[color=#000000]([/color]TComponent* Owner[color=#000000])[/color]
[color=#000000]:[/color] TForm[color=#000000]([/color]Owner[color=#000000])[/color]
{
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1[color=#000000]:[/color][color=#000000]:[/color] ButtonShow1Click[color=#000000]([/color]TObject *Sender[color=#000000])[/color]
{
TChlup c[color=#000000]([/color]Edit1->Text[color=#000000])[/color];
Memo1->Lines->Add[color=#000000]([/color]c.Value[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1[color=#000000]:[/color][color=#000000]:[/color]ButtonAddClick[color=#000000]([/color]TObject *Sender[color=#000000])[/color]
{
TChlup a[color=#000000]([/color]Edit1->Text[color=#000000])[/color], b[color=#000000]([/color]Edit2->Text[color=#000000])[/color];
TChlup c[color=#000000]([/color]a+b[color=#000000])[/color];
Memo1->Lines->Add[color=#000000]([/color]c.Value[color=#000000]([/color][color=#000000])[/color][color=#000000])[/color];

}
[/code][/size]
[size=10px]Formatting based on Jiri Valerian's ideas[/size]

Citovat příspěvek

 

Re: Test smajliku

Autor: tcesky

16:13:31 12.04.2005

[size=12px][code]
[color=#008000]#include "ChlupMain.h"[/color]
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
[color=#800000]class[/color] TChlup
{ [color=#800000]public[/color][color=#000080]:[/color]
[color=#800000]bool[/color] Positive;
[color=#800000]AnsiString[/color] Data; [color=#C0C0C0]// digits from lower to higher order[/color]
TChlup([color=#800000]bool[/color] pos=[color=#800000]true[/color])[color=#000080]:[/color]Positive(pos){}
TChlup([color=#800000]AnsiString[/color] val)[color=#000080]:[/color]Data(val.Trim()),Positive([color=#800000]true[/color])
{ [color=#800000]if[/color](Data.SubString(1,1)=='+')Data=Data.SubString(2,Data.Length());
[color=#800000]else[/color]
[color=#800000]if[/color](Data.SubString(1,1)=='-')
{ Data=Data.SubString(2,Data.Length());
Positive=[color=#800000]false[/color];
}
strrev(Data.c_str());
}
TChlup([color=#800000]const[/color] TChlup [color=#000080]&[/color]c)[color=#000080]:[/color]Data(c.Data),Positive(c.Positive){}
[color=#800000]AnsiString[/color] Value()
{ [color=#800000]AnsiString[/color] str(Data);
[color=#800000]if[/color](str.Length()<1)str="0";
strrev(str.c_str());
[color=#800000]if[/color](!Positive)str="-"+str;
[color=#800000]return[/color] str;
}
[color=#800000]bool[/color] [color=#800000]operator[/color] < ([color=#800000]const[/color] TChlup [color=#000080]&[/color]a)[color=#800000]const[/color]
{ [color=#800000]if[/color](!Positive [color=#000080]&[/color][color=#000080]&[/color] a.Positive)[color=#800000]return[/color] [color=#800000]true[/color];
[color=#800000]if[/color](Positive [color=#000080]&[/color][color=#000080]&[/color] !a.Positive)[color=#800000]return[/color] [color=#800000]false[/color];
[color=#800000]int[/color] l1(Data.Length()), l2(a.Data.Length());
[color=#800000]int[/color] ret(l1-l2);
[color=#800000]if[/color](ret==0)
[color=#800000]if[/color](l1 > 0)
ret=Data[l1]-a.Data[l2];
[color=#800000]if[/color](!Positive [color=#000080]&[/color][color=#000080]&[/color] !a.Positive)ret*=-1;
[color=#800000]return[/color] ret < 0;
}
TChlup Abs()[color=#800000]const[/color]{ TChlup c(*[color=#800000]this[/color]); c.Positive=[color=#800000]true[/color]; [color=#800000]return[/color] c;}
TChlup [color=#800000]friend[/color] [color=#800000]operator[/color] +([color=#800000]const[/color] TChlup [color=#000080]&[/color]a, [color=#800000]const[/color] TChlup [color=#000080]&[/color]b)
{ [color=#800000]if[/color]( a.Positive [color=#000080]&[/color][color=#000080]&[/color] b.Positive)[color=#800000]return[/color] TChlup[color=#000080]:[/color][color=#000080]:[/color]AbsAdd(a,b,[color=#800000]true[/color]);
[color=#800000]if[/color](!a.Positive [color=#000080]&[/color][color=#000080]&[/color] !b.Positive)[color=#800000]return[/color] TChlup[color=#000080]:[/color][color=#000080]:[/color]AbsAdd(a,b,[color=#800000]false[/color]);
[color=#800000]if[/color]( a.Positive [color=#000080]&[/color][color=#000080]&[/color] !b.Positive)[color=#800000]return[/color] TChlup[color=#000080]:[/color][color=#000080]:[/color]AbsSub(a.Abs(),b.Abs());
[color=#800000]if[/color](!a.Positive [color=#000080]&[/color][color=#000080]&[/color] b.Positive)[color=#800000]return[/color] TChlup[color=#000080]:[/color][color=#000080]:[/color]AbsSub(b.Abs(),a.Abs());
[color=#800000]return[/color] TChlup();
}
[color=#800000]static[/color] TChlup AbsAdd([color=#800000]const[/color] TChlup [color=#000080]&[/color]A, [color=#800000]const[/color] TChlup [color=#000080]&[/color]B, [color=#800000]bool[/color] Positive)
{ TChlup c(Positive);
[color=#800000]const[/color] [color=#800000]char[/color] *a(A.Data.c_str()), *b(B.Data.c_str());
[color=#800000]int[/color] carry(0);
[color=#800000]for[/color](;*a [color=#000080]&[/color][color=#000080]&[/color] *b;a++,b++)
{ [color=#800000]int[/color] s=(*a-'0') + (*b-'0')+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]if[/color](*a==0)a=b;
[color=#800000]for[/color](;*a;a++)
{ [color=#800000]int[/color] s=(*a-'0')+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]if[/color](carry)c.Data+=[color=#800000]char[/color]('0'+carry);
[color=#800000]return[/color] c;
}
[color=#800000]static[/color] TChlup AbsSub([color=#800000]const[/color] TChlup [color=#000080]&[/color]A, [color=#800000]const[/color] TChlup [color=#000080]&[/color]B)
{ TChlup c;
[color=#800000]if[/color](A < B)
{ c=AbsSub(B, A);
c.Positive=[color=#800000]false[/color];
[color=#800000]return[/color] c;
}
[color=#800000]const[/color] [color=#800000]char[/color] *a(A.Data.c_str()), *b(B.Data.c_str());
[color=#800000]int[/color] carry(0);
[color=#800000]for[/color](;*a [color=#000080]&[/color][color=#000080]&[/color] *b;a++,b++)
{ [color=#800000]int[/color] s=10+(*a-'0') - (*b-'0')-carry;
[color=#800000]if[/color](s >=10){ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]for[/color](;*a;a++)
{ [color=#800000]int[/color] s=(*a-'0')-carry;
[color=#800000]if[/color](s >=10){ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]return[/color] c;
}
};
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
__fastcall TForm1[color=#000080]:[/color][color=#000080]:[/color]TForm1(TComponent* Owner)
[color=#000080]:[/color] TForm(Owner)
{
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1[color=#000080]:[/color][color=#000080]:[/color] ButtonShow1Click(TObject *Sender)
{
TChlup c(Edit1->Text);
Memo1->Lines->Add(c.Value());
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1[color=#000080]:[/color][color=#000080]:[/color]ButtonAddClick(TObject *Sender)
{
TChlup a(Edit1->Text), b(Edit2->Text);
TChlup c(a+b);
Memo1->Lines->Add(c.Value());

}
[/code][/size]
[size=10px]Formatting based on Jiri Valerian's ideas[/size]

Citovat příspěvek

 

Re: Test smajliku

Autor: tcesky

16:08:17 12.04.2005

[size=12px][code]
[color=#008000]#include "ChlupMain.h"[/color]
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
[color=#800000]class[/color] TChlup
{ [color=#800000]public[/color]:
[color=#800000]bool[/color] Positive;
[color=#800000]AnsiString[/color] Data; [color=#C0C0C0]// digits from lower to higher order[/color]
TChlup([color=#800000]bool[/color] pos=[color=#800000]true[/color]): Positive(pos){}
TChlup([color=#800000]AnsiString[/color] val): Data(val.Trim()),Positive([color=#800000]true[/color])
{ [color=#800000]if[/color](Data.SubString(1,1)=='+')Data=Data.SubString(2,Data.Length());
[color=#800000]else[/color]
[color=#800000]if[/color](Data.SubString(1,1)=='-')
{ Data=Data.SubString(2,Data.Length());
Positive=[color=#800000]false[/color];
}
strrev(Data.c_str());
}
TChlup([color=#800000]const[/color] TChlup & c): Data(c.Data),Positive(c.Positive){}
[color=#800000]AnsiString[/color] Value()
{ [color=#800000]AnsiString[/color] str(Data);
[color=#800000]if[/color](str.Length()<1)str="0";
strrev(str.c_str());
[color=#800000]if[/color](!Positive)str="-"+str;
[color=#800000]return[/color] str;
}
[color=#800000]bool[/color] [color=#800000]operator[/color] < ([color=#800000]const[/color] TChlup & a)[color=#800000]const[/color]
{ [color=#800000]if[/color](!Positive && a.Positive)[color=#800000]return[/color] [color=#800000]true[/color];
[color=#800000]if[/color](Positive && !a.Positive)[color=#800000]return[/color] [color=#800000]false[/color];
[color=#800000]int[/color] l1(Data.Length()), l2(a.Data.Length());
[color=#800000]int[/color] ret(l1-l2);
[color=#800000]if[/color](ret==0)
[color=#800000]if[/color](l1 > 0)
ret=Data[l1]-a.Data[l2];
[color=#800000]if[/color](!Positive && !a.Positive)ret*=-1;
[color=#800000]return[/color] ret < 0;
}
TChlup Abs()[color=#800000]const[/color]{ TChlup c(*[color=#800000]this[/color]); c.Positive=[color=#800000]true[/color]; [color=#800000]return[/color] c;}
TChlup [color=#800000]friend[/color] [color=#800000]operator[/color] +([color=#800000]const[/color] TChlup & a, [color=#800000]const[/color] TChlup & b)
{ [color=#800000]if[/color]( a.Positive && b.Positive)[color=#800000]return[/color] TChlup:: AbsAdd(a,b,[color=#800000]true[/color]);
[color=#800000]if[/color](!a.Positive && !b.Positive)[color=#800000]return[/color] TChlup:: AbsAdd(a,b,[color=#800000]false[/color]);
[color=#800000]if[/color]( a.Positive && !b.Positive)[color=#800000]return[/color] TChlup:: AbsSub(a.Abs(),b.Abs());
[color=#800000]if[/color](!a.Positive && b.Positive)[color=#800000]return[/color] TChlup:: AbsSub(b.Abs(),a.Abs());
[color=#800000]return[/color] TChlup();
}
[color=#800000]static[/color] TChlup AbsAdd([color=#800000]const[/color] TChlup & A, [color=#800000]const[/color] TChlup & B, [color=#800000]bool[/color] Positive)
{ TChlup c(Positive);
[color=#800000]const[/color] [color=#800000]char[/color] *a(A.Data.c_str()), *b(B.Data.c_str());
[color=#800000]int[/color] carry(0);
[color=#800000]for[/color](;*a && *b;a++,b++)
{ [color=#800000]int[/color] s=(*a-'0') + (*b-'0')+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]if[/color](*a==0)a=b;
[color=#800000]for[/color](;*a;a++)
{ [color=#800000]int[/color] s=(*a-'0')+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]if[/color](carry)c.Data+=[color=#800000]char[/color]('0'+carry);
[color=#800000]return[/color] c;
}
[color=#800000]static[/color] TChlup AbsSub([color=#800000]const[/color] TChlup & A, [color=#800000]const[/color] TChlup & B)
{ TChlup c;
[color=#800000]if[/color](A < B)
{ c=AbsSub(B, A);
c.Positive=[color=#800000]false[/color];
[color=#800000]return[/color] c;
}
[color=#800000]const[/color] [color=#800000]char[/color] *a(A.Data.c_str()), *b(B.Data.c_str());
[color=#800000]int[/color] carry(0);
[color=#800000]for[/color](;*a && *b;a++,b++)
{ [color=#800000]int[/color] s=10+(*a-'0') - (*b-'0')-carry;
[color=#800000]if[/color](s >=10){ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]for[/color](;*a;a++)
{ [color=#800000]int[/color] s=(*a-'0')-carry;
[color=#800000]if[/color](s >=10){ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]return[/color] c;
}
};
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
__fastcall TForm1:: TForm1(TComponent* Owner)
: TForm(Owner)
{
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1:: ButtonShow1Click(TObject *Sender)
{
TChlup c(Edit1->Text);
Memo1->Lines->Add(c.Value());
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1:: ButtonAddClick(TObject *Sender)
{
TChlup a(Edit1->Text), b(Edit2->Text);
TChlup c(a+b);
Memo1->Lines->Add(c.Value());

}
[/code][/size]
[size=10px]Formatting based on Jiri Valerian's ideas[/size]

Citovat příspěvek

 

Re: Test smajliku

Autor: tcesky

16:06:18 12.04.2005

[size=12px][code]
[color=#008000]#include "ChlupMain.h"[/color]
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
[color=#800000]class[/color] TChlup
{ [color=#800000]public[/color]:
[color=#800000]bool[/color] Positive;
[color=#800000]AnsiString[/color] Data; [color=#C0C0C0]// digits from lower to higher order[/color]
TChlup([color=#800000]bool[/color] pos=[color=#800000]true[/color]): Positive(pos){}
TChlup([color=#800000]AnsiString[/color] val): Data(val.Trim()),Positive([color=#800000]true[/color])
{ [color=#800000]if[/color](Data.SubString(1,1)=='+')Data=Data.SubString(2,Data.Length());
[color=#800000]else[/color]
[color=#800000]if[/color](Data.SubString(1,1)=='-')
{ Data=Data.SubString(2,Data.Length());
Positive=[color=#800000]false[/color];
}
strrev(Data.c_str());
}
TChlup([color=#800000]const[/color] TChlup &c): Data(c.Data),Positive(c.Positive){}
[color=#800000]AnsiString[/color] Value()
{ [color=#800000]AnsiString[/color] str(Data);
[color=#800000]if[/color](str.Length()<1)str="0";
strrev(str.c_str());
[color=#800000]if[/color](!Positive)str="-"+str;
[color=#800000]return[/color] str;
}
[color=#800000]bool[/color] [color=#800000]operator[/color] < ([color=#800000]const[/color] TChlup &a)[color=#800000]const[/color]
{ [color=#800000]if[/color](!Positive && a.Positive)[color=#800000]return[/color] [color=#800000]true[/color];
[color=#800000]if[/color](Positive && !a.Positive)[color=#800000]return[/color] [color=#800000]false[/color];
[color=#800000]int[/color] l1(Data.Length()), l2(a.Data.Length());
[color=#800000]int[/color] ret(l1-l2);
[color=#800000]if[/color](ret==0)
[color=#800000]if[/color](l1 > 0)
ret=Data[l1]-a.Data[l2];
[color=#800000]if[/color](!Positive && !a.Positive)ret*=-1;
[color=#800000]return[/color] ret < 0;
}
TChlup Abs()[color=#800000]const[/color]{ TChlup c(*[color=#800000]this[/color]); c.Positive=[color=#800000]true[/color]; [color=#800000]return[/color] c;}
TChlup [color=#800000]friend[/color] [color=#800000]operator[/color] +([color=#800000]const[/color] TChlup &a, [color=#800000]const[/color] TChlup &b)
{ [color=#800000]if[/color]( a.Positive && b.Positive)[color=#800000]return[/color] TChlup:: AbsAdd(a,b,[color=#800000]true[/color]);
[color=#800000]if[/color](!a.Positive && !b.Positive)[color=#800000]return[/color] TChlup:: AbsAdd(a,b,[color=#800000]false[/color]);
[color=#800000]if[/color]( a.Positive && !b.Positive)[color=#800000]return[/color] TChlup:: AbsSub(a.Abs(),b.Abs());
[color=#800000]if[/color](!a.Positive && b.Positive)[color=#800000]return[/color] TChlup:: AbsSub(b.Abs(),a.Abs());
[color=#800000]return[/color] TChlup();
}
[color=#800000]static[/color] TChlup AbsAdd([color=#800000]const[/color] TChlup &A, [color=#800000]const[/color] TChlup &B, [color=#800000]bool[/color] Positive)
{ TChlup c(Positive);
[color=#800000]const[/color] [color=#800000]char[/color] *a(A.Data.c_str()), *b(B.Data.c_str());
[color=#800000]int[/color] carry(0);
[color=#800000]for[/color](;*a && *b;a++,b++)
{ [color=#800000]int[/color] s=(*a-'0') + (*b-'0')+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]if[/color](*a==0)a=b;
[color=#800000]for[/color](;*a;a++)
{ [color=#800000]int[/color] s=(*a-'0')+carry;
carry=s/10;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]if[/color](carry)c.Data+=[color=#800000]char[/color]('0'+carry);
[color=#800000]return[/color] c;
}
[color=#800000]static[/color] TChlup AbsSub([color=#800000]const[/color] TChlup &A, [color=#800000]const[/color] TChlup &B)
{ TChlup c;
[color=#800000]if[/color](A < B)
{ c=AbsSub(B, A);
c.Positive=[color=#800000]false[/color];
[color=#800000]return[/color] c;
}
[color=#800000]const[/color] [color=#800000]char[/color] *a(A.Data.c_str()), *b(B.Data.c_str());
[color=#800000]int[/color] carry(0);
[color=#800000]for[/color](;*a && *b;a++,b++)
{ [color=#800000]int[/color] s=10+(*a-'0') - (*b-'0')-carry;
[color=#800000]if[/color](s >=10){ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]for[/color](;*a;a++)
{ [color=#800000]int[/color] s=(*a-'0')-carry;
[color=#800000]if[/color](s >=10){ s-=10; carry=0; }
[color=#800000]else[/color] carry=1;
c.Data+=[color=#800000]char[/color]('0'+s%10);
}
[color=#800000]return[/color] c;
}
};
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
__fastcall TForm1:: TForm1(TComponent* Owner)
: TForm(Owner)
{
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1:: ButtonShow1Click(TObject *Sender)
{
TChlup c(Edit1->Text);
Memo1->Lines->Add(c.Value());
}
[color=#C0C0C0]//---------------------------------------------------------------------------[/color]
[color=#800000]void[/color] __fastcall TForm1:: ButtonAddClick(TObject *Sender)
{
TChlup a(Edit1->Text), b(Edit2->Text);
TChlup c(a+b);
Memo1->Lines->Add(c.Value());

}
[/code][/size]
[size=10px]Formatting based on Jiri Valerian's ideas[/size]

Citovat příspěvek

 

Test smajliku

Autor: tcesky

15:59:17 12.04.2005

[size=12px][code]
TChlup([color=#800000]bool[/color] pos=[color=#800000]true[/color]): Positive(pos){}
TChlup([color=#800000]AnsiString[/color] val): Data(val.Trim()),Positive([color=#800000]true[/color])
{ [color=#800000]if[/color](Data.SubString(1,1)=='+')Data=Data.SubString(2,Data.Length());
[color=#800000]else[/color]
[color=#800000]if[/color](Data.SubString(1,1)=='-')
{ Data=Data.SubString(2,Data.Length());
Positive=[color=#800000]false[/color];
}
strrev(Data.c_str());
[/code][/size]
[size=10px]Formatting based on Jiri Valerian's ideas[/size]

[size=12px][code]
TChlup([color=#800000]bool[/color] pos=[color=#800000]true[/color]): Positive(pos){}
TChlup([color=#800000]AnsiString[/color] val)[pre]:[/pre]Data(val.Trim()),Positive([color=#800000]true[/color])
{ [color=#800000]if[/color](Data.SubString(1,1)=='+')Data=Data.SubString(2,Data.Length());
[color=#800000]else[/color]
[color=#800000]if[/color](Data.SubString(1,1)=='-')
{ Data=Data.SubString(2,Data.Length());
Positive=[color=#800000]false[/color];
}
strrev(Data.c_str());
[/code][/size]
[size=10px]Formatting based on Jiri Valerian's ideas[/size]

Citovat příspěvek

 

Re: Rozbité formátování

Autor: MazeGen

20:27:39 06.04.2005

Přidávám se, je to blbý.

Zajímalo by mě, proč se píšou pořád další a další fóra, když už existuje tolik stabilních a osvědčených, navíc odolných proti hackingu. Proč nepoužívat třeba simplemachines.org?

Citovat příspěvek

 

Re: Rozbité formátování

Autor: Mormegil

14:30:29 06.04.2005

Zato smajlíky to láduje všude možně. Minimálně by to chtělo checkbox „nevkládat smajlíky“, takhle to je příšerné. Navíc je rozpoznává pěkně blbě. :o a :o) je dost rozdíl. A fakt, že se nerozpoznávají v náhledu, to už je úplná šílenost, k čemu pak ten náhled je, když funguje jinak, než finální zobrazení??

Citovat příspěvek

 

Rozbité formátování

Autor: Mormegil

14:28:08 06.04.2005

V novém fóru jsou i nové tagy, jenže chybí jim spousta důležitých vlastností, hlavně:

Nefungují HTML entity (– Ӓ ꯍ).
Tag url je rozbitý:
(url=http://www.example.com/)nějaký text(/url) udělá:
[url=http://www.example.com/]nějaký text[/url] a na text odkazu to kašle.

Citovat příspěvek

 

 

 

Přihlášení k mému účtu

Uživatelské jméno:

Heslo: