نمایش نتایج 1 تا 5 از 5

نام تاپیک: ترتیب عملگرهای محاسباتی تویه پاسکال

  1. #1

    Tick ترتیب عملگرهای محاسباتی تویه پاسکال

    سلام
    ترتیب عملگرهای محاسباتی تویه پاسکال رو براساس اولویت اجرا می خواستم.
    پاک با بیسیک قاطی پاتی کردم.

  2. #2
    کاربر دائمی
    تاریخ عضویت
    فروردین 1385
    محل زندگی
    آنجا سرای ابدی است
    پست
    2,011
    نباید فرقی داشته باشه! مشابهات را جایگزین کنید. تا اونجاکه با Qbasic مقایسه می کنم مشکلی نبوده.

  3. #3
    نقل قول نوشته شده توسط dkhatibi مشاهده تاپیک
    نباید فرقی داشته باشه! مشابهات را جایگزین کنید. تا اونجاکه با Qbasic مقایسه می کنم مشکلی نبوده.
    آخه تو جزواتم تا اونجایی که یادمه که استادمون تفریق یکانی و تقسیم اعشاری رو نگفته بود حالا من اون صفحه رو گم کردم برای همین شک دارم که گفته یا نه.
    آیا با Visual Basic یکسان هستش یا نه؟

  4. #4
    In complex expressions, rules of precedence determine the order in which operations are performed.

    Precedence of operators
    Operators Precedence
    @, not first (highest)
    *, /, div, mod, and, shl, shr, as second
    +, -, or, xor third
    =, <>, <, >, <=, >=, in, is fourth (lowest)
    An operator with higher precedence is evaluated before an operator with lower precedence, while operators of equal precedence associate to the left. Hence the expression

    X + Y * Z

    multiplies Y times Z, then adds X to the result; * is performed first, because is has a higher precedence than +. But

    X - Y + Z

    first subtracts Y from X, then adds Z to the result; - and + have the same precedence, so the operation on the left is performed first.

    You can use parentheses to override these precedence rules. An expression within parentheses is evaluated first, then treated as a single operand. For example,

    (X + Y) * Z

    multiplies Z times the sum of X and Y.

    Parentheses are sometimes needed in situations where, at first glance, they seem not to be. For example, consider the expression

    X = Y or X = Z

    The intended interpretation of this is obviously

    (X = Y) or (X = Z)

    Without parentheses, however, the compiler follows operator precedence rules and reads it as

    (X = (Y or X)) = Z

    which results in a compilation error unless Z is Boolean.

    Parentheses often make code easier to write and to read, even when they are, strictly speaking, superfluous. Thus the first example could be written as

    X + (Y * Z)

    Here the parentheses are unnecessary (to the compiler), but they spare both programmer and reader from having to think about operator precedence.


    وَ سَيَعْلَمُ الَّذِينَ ظَلَمُوا [آل محمد حقهم] أَيَّ مُنْقَلَبٍ يَنْقَلِبُونَ - الشعراء (227)
    و ظالمین [حق آل محمد (ص) ] به زودی خواهند دانست که به کدام بازگشتگاه بازخواهند گشت.

  5. #5
    آیا با Visual Basic یکسان هستش یا نه؟
    این موضوع ربطی به زبان برنامه نویسی نداره ، اینها باید در زبانها رعایت بشن ، اینها قاعده کلی دارن که مربوط به ریاضی هست ، اگر این قانونها در هر زبانی متفاوت باشن ، موقع نوشتن الگوریتم باید بسته به نوع زبان ، الگوریتم رو تغییر داد !!

    موفق باشید ...

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •