View previous topic :: View next topic |
Author |
Message |
jongwee Moderator
Reputation: 0
Joined: 28 Jun 2006 Posts: 1388 Location: Singapore
|
Posted: Thu Dec 06, 2007 3:15 am Post subject: Delphi question |
|
|
Hi, I'd like to ask a simple question.
If I have integers, for example:
Code: | a:integer;
b:integer;
c:integer;
d:integer;
e:integer;
f:integer; |
And I want to have a string which is the addition of all this strings, in C++, its just
But if in delphi? And if I am going to display the value of a (The string), how do I go around doing it?
Thanks
_________________
|
|
Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Thu Dec 06, 2007 3:38 am Post subject: Re: Delphi question |
|
|
jongwee wrote: | Hi, I'd like to ask a simple question.
If I have integers, for example:
Code: | a:integer;
b:integer;
c:integer;
d:integer;
e:integer;
f:integer; |
And I want to have a string which is the addition of all this strings, in C++, its just
But if in delphi? And if I am going to display the value of a (The string), how do I go around doing it?
Thanks |
a := IntToStr(b + c + d + e + f)
I think.
_________________
haxory' wrote: | can't VB do anything??
windows is programmed using VB right? correct me if im wrong.
so all things in windows you have like the start menu is a windows form too. |
|
|
Back to top |
|
 |
Lewiathan How do I cheat?
Reputation: 0
Joined: 06 Dec 2007 Posts: 5
|
Posted: Thu Dec 06, 2007 12:37 pm Post subject: Re: Delphi question |
|
|
Xenephobe wrote: | jongwee wrote: | Hi, I'd like to ask a simple question.
If I have integers, for example:
Code: | a:integer;
b:integer;
c:integer;
d:integer;
e:integer;
f:integer; |
And I want to have a string which is the addition of all this strings, in C++, its just
But if in delphi? And if I am going to display the value of a (The string), how do I go around doing it?
Thanks |
a := IntToStr(b + c + d + e + f)
I think. |
Not exactly,
'a' is variable type integer
,
but function IntToStr return string variable.
My suggestion is:
declare another string variable, eg:
after:
Code: | sumstr:=IntToStr(b + c + d + e + f); |
or:
Code: | sumstr:=format('%d',[b + c + d + e + f]); |
Last edited by Lewiathan on Thu Dec 06, 2007 1:20 pm; edited 1 time in total |
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Dec 06, 2007 1:07 pm Post subject: |
|
|
Code: | var
a,b,c,d,e,f,sum:integer;
begin
//your code here that scans for the number
sum:=a+b+c+d+e+f;
ShowMessage(StrToInt(sum)); //result
end; |
|
|
Back to top |
|
 |
Lewiathan How do I cheat?
Reputation: 0
Joined: 06 Dec 2007 Posts: 5
|
Posted: Thu Dec 06, 2007 1:18 pm Post subject: |
|
|
Kaspersky wrote: | Code: | var
a,b,c,d,e,f,sum:integer;
begin
//your code here that scans for the number
sum:=a+b+c+d+e+f;
ShowMessage(StrToInt(sum)); //result
end; |
|
hmm,
rather:
Code: | ShowMessage(IntToStr(sum)); //result |
|
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Dec 06, 2007 1:25 pm Post subject: |
|
|
Fuck, i ment IntToStr rofl, wow... i must be drunk
|
|
Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Thu Dec 06, 2007 5:50 pm Post subject: |
|
|
You don't really have to declare 'sum' unless you are going to use that value again.
ShowMessage(IntToStr(a + b + c + d + e + f)); works too.
|
|
Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Fri Dec 07, 2007 7:13 am Post subject: |
|
|
rapion124 wrote: | You don't really have to declare 'sum' unless you are going to use that value again.
ShowMessage(IntToStr(a + b + c + d + e + f)); works too. |
if course not, it'll be clearer.
|
|
Back to top |
|
 |
|