armm1388
شنبه 07 اردیبهشت 1392, 12:49 عصر
با سلام
می خواهم علامت مقایسه ای را به دو عدد به تابع بفرستم. حال در تابع چگونه دستورش را بنویسم؟
مثال:
(int d1, int d2, string operator)
(12, 14, “>”).
حال شرط را چگونه در تابع پیاده سازی کنیم؟
if (d1 operator d2) // is incorrect
if (d1 + operator + d2) // is incorrect
if (convert.toBolean (d1+ operator + d2)) // is incorrect
می خواهم علامت مقایسه ای را به دو عدد به تابع بفرستم. حال در تابع چگونه دستورش را بنویسم؟
مثال:
(int d1, int d2, string operator)
(12, 14, “>”).
حال شرط را چگونه در تابع پیاده سازی کنیم؟
if (d1 operator d2) // is incorrect
if (d1 + operator + d2) // is incorrect
if (convert.toBolean (d1+ operator + d2)) // is incorrect