Recent

Author Topic: Help me Please from Turkey  (Read 12351 times)

kmalpha

  • New Member
  • *
  • Posts: 27
Help me Please from Turkey
« on: December 22, 2014, 07:00:06 pm »
(text was translated from Turkish)
-three number will be entered
-This will create the smallest three-digit number with three numbers
-This will create the largest number of three digits with three numbers
-Created to find the difference of two numbers
Example;
Enter the first number:4
Enter the second number:3
Enter the third number:6
Result:
large number=643
small number=346
643-346=297
write for turbo pascal
« Last Edit: December 23, 2014, 08:52:57 am by kmalpha »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Help me Please from Turkey
« Reply #1 on: December 22, 2014, 07:13:11 pm »
This forum might help with homework, but only give tips based on what you already did yourself.

Please show what you have so far.


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Help me Please from Turkey
« Reply #2 on: December 22, 2014, 07:28:10 pm »
generate the first number - by sorting from greatest digit to the lesser one.
generate the second number by sorting from least digit to the greatest.
(can be done via string operations, since character comparison will work)

then calculate the difference.

Please donate to Lazarus  $5 or 5 euro

kmalpha

  • New Member
  • *
  • Posts: 27
Re: Help me Please from Turkey
« Reply #3 on: December 22, 2014, 08:00:47 pm »
Can you give me tips?

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: Help me Please from Turkey
« Reply #4 on: December 22, 2014, 08:25:26 pm »
Well, first write code to get the three numbers (digits actually) and think of a way to store them (what kind of data type?).
Then think of a way to sort them.
The rest is easy.

Show us the code you have, then we'll give more tips.

Bart

kmalpha

  • New Member
  • *
  • Posts: 27
Re: Help me Please from Turkey
« Reply #5 on: December 22, 2014, 10:01:34 pm »
Where should I start

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Help me Please from Turkey
« Reply #6 on: December 22, 2014, 10:14:26 pm »
Show us the code you have, then we'll give more tips.
or the opposite - tip us and we'll show you the code  :D

CM630

  • Hero Member
  • *****
  • Posts: 1076
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Help me Please from Turkey
« Reply #7 on: December 22, 2014, 10:17:25 pm »
I guess the idea of our homework is to learn bubble sort.
And I am sure you can find a ready solution for that.
Лазар 3,0 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Help me Please from Turkey
« Reply #8 on: December 22, 2014, 10:19:43 pm »
I guess the idea of our homework is to learn bubble sort.
And I am sure you can find a ready solution for that.
it doesn't look like bubble sort since it's only 3 characters.
« Last Edit: December 22, 2014, 10:31:38 pm by skalogryz »

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Help me Please from Turkey
« Reply #9 on: December 22, 2014, 10:37:45 pm »
Quote
Where should I start ?

Code: [Select]
procedure MyHomeWork;
var aKey, bKey, cKey: char;
begin
writeln('Press first number and press ENTER...');
read(aKey);  //=> this will read first character entered and store it in aKey variable (after ENTER pressed)

writeln('Press second number and press ENTER...');
read(bKey);  //=> this will read second character entered and store it in bKey variable (after ENTER pressed)

writeln('Press third number and press ENTER...');
read(cKey);  //=> this will read third character entered store and it in cKey variable (after ENTER pressed)

...  // => Your turn now...

end;
« Last Edit: December 22, 2014, 10:48:51 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Help me Please from Turkey
« Reply #10 on: December 22, 2014, 11:40:36 pm »
Well, people here don't resist to a challenge.

kmalpha

  • New Member
  • *
  • Posts: 27
Re: Help me Please from Turkey
« Reply #11 on: December 23, 2014, 12:59:31 am »
Quote
Where should I start ?

Code: [Select]
procedure MyHomeWork;
var aKey, bKey, cKey: char;
begin
writeln('Press first number and press ENTER...');
read(aKey);  //=> this will read first character entered and store it in aKey variable (after ENTER pressed)

writeln('Press second number and press ENTER...');
read(bKey);  //=> this will read second character entered and store it in bKey variable (after ENTER pressed)

writeln('Press third number and press ENTER...');
read(cKey);  //=> this will read third character entered store and it in cKey variable (after ENTER pressed)

...  // => Your turn now...

end;
Quote
Where should I start ?

Code: [Select]
procedure MyHomeWork;
var aKey, bKey, cKey: char;
begin
writeln('Press first number and press ENTER...');
read(aKey);  //=> this will read first character entered and store it in aKey variable (after ENTER pressed)

writeln('Press second number and press ENTER...');
read(bKey);  //=> this will read second character entered and store it in bKey variable (after ENTER pressed)

writeln('Press third number and press ENTER...');
read(cKey);  //=> this will read third character entered store and it in cKey variable (after ENTER pressed)

...  // => Your turn now...

end;
but this is a very simple part of

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Help me Please from Turkey
« Reply #12 on: December 23, 2014, 01:02:06 am »
Please show us some work and we will contribute with it.

With this code you have a starting point.

Since you have only 3 digits, you can use Min/Max functions to determine the minimum, maximum and intermediate values.
« Last Edit: December 23, 2014, 04:09:17 am by typo »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Help me Please from Turkey
« Reply #13 on: December 23, 2014, 05:35:38 am »
kmalpha, why bother?! just donate $5 and you'll get the code! help FPC/Lazarus community to grow.

kmalpha

  • New Member
  • *
  • Posts: 27
Re: Help me Please from Turkey
« Reply #14 on: December 23, 2014, 08:50:45 am »
kmalpha, why bother?! just donate $5 and you'll get the code! help FPC/Lazarus community to grow.
I'm not good for now, but I promise you donate donation will be exposed in the first month.Can you help me?Please

 

TinyPortal © 2005-2018