עזרה מהירה בפסקל - Random - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

עזרה מהירה בפסקל - Random


Boomer

Recommended Posts

למדנו Random בפסקל והמורה אמרה לנו שבשביל שהמחשב ימצא מספרים עשרוניים צריך לכתוב משהו כמו

;X:= Random 0<=X<8

העניין הוא שזה לא פועל - זה כותב שחסר ";" אחרי ה-Random.

אז נראה לי שהמורה התבלבלה או משהו...

אז איך עושים את זה?

קישור לתוכן
שתף באתרים אחרים

  • 2 שבועות מאוחר יותר...

The random command in has two forms.
1) x=Random(n)+m; -> Gives x a value in the range (m..m+n-1)
2) x=Random; -> Gives x a random floating point value between 0..1
In order to generate a general floating point number between x and y you should write:
t=random*(y-x)+x -> Assuming x is the smallest.

I'm sorry I'm writing in English but I tried to answer the C thing in hebrew and it got all screwed up...
Can somebody tell me how to make a "box" of english text inside hebrew text in here?

קישור לתוכן
שתף באתרים אחרים

  • 2 שבועות מאוחר יותר...

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

×
  • צור חדש...