检查是否...如何将其转换为C代码[暂停]

问题描述 投票:-2回答:1

如何将此伪代码转换为C?

check if  EITHER                                                             
    ((x is between x_offset  and x_offset +size2) AND                        
     y is equal to either y_offset OR y_offset + size2 - 1 )                 
  OR                                                                         
    ((y is between y_offset and y_offset + size2) AND                        
     x is equal to either x_offset OR x_offset + size2 -1)                   
if so, print a *`enter code here`
c
1个回答
-1
投票
if( ( (x > x_offset && x < x_offset + size2) &&
      (y == y_offset || y == y_offset + size2 - 1) ) ||
    ( (y > y_offset && y < y_offset + size2) &&
      (x == x_offset || x == x_offset + size2 - 1) ) )
    printf("*");

也许试着理解if语句如何在C语言中起作用以及&&||运算符如何在C中运行.https://guide.freecodecamp.org/c/if-statements/


推荐问答