看板 b99902HW 關於我們 聯絡資訊
我今天寫作業時發現的。 (int)plaintext[i]=((int)plaintext[i]-key-97+26)%26+97; 和 plaintext[i]=(plaintext[i]+temp_key-97+26)%26+97; 我覺得這兩行是一樣的東西 在Dev上跑也沒有問題 可是批改娘卻對我抱怨: source.c:54: error: lvalue required as left operand of assignment 有哪位同學可以幫我看看兩者差在哪裡嗎 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.241.203
shik:=左邊放的東西不應有(int)之類的操作 10/26 19:44
shik:大概就像我們會寫a=2不會寫a+1=3 XD 10/26 19:45
BingJing:(int)是做casting,例如浮點數要轉整數,會傳回結果 10/26 21:27