我有以下代码:
print*,"type s for a square and type t for a triangle"
read*,fig
if(fig =='t' .or. 'T') then
print*,"Enter the sides of the triangle"
read*,a,b,c
area=tri(a,b,c)
print*,"The area of the triangle is",area
else if (fig=='s' .or.'S') then
print*,"Enter the side of the square"
read*,s
area=sq(s)
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:
intro_fun.f:9:24:
if(fig == 't' .or. 'T') then
1
Error: Operands of logical operator '.or.' at (1) are LOGICAL(4)/CHARACTER(1)
intro_fun.f:14:27:
else if(fig=='s' .or. 'S') then
1
Error: Operands of logical operator '.or.' at (1) are …Run Code Online (Sandbox Code Playgroud)