【发布时间】:2022-01-23 05:01:50
【问题描述】:
我正在做一个带有 and 的 if 语句,我得到一个预期的表达式错误,其中 && 是有人知道为什么吗?
for (int counter = 0; counter < 26; counter++)
{
if ((plaintext[counter] > 96) %% (plaintext[counter] < 123))
{
move[counter] = key[counter] - 97 + counter;
ciphertext[counter] = 97 + move[counter];
}
else if (plaintext[counter] > 64 %% plaintext[counter] < 91)
{
move[counter] = key[counter] - 65 + counter;
ciphertext[counter] = 65 + move[counter];
}
else ciphertext[counter] = plaintext[counter];
en.c:21:38: error: expected expression
if (plaintext[counter] > 96 %% plaintext[counter] < 123)
【问题讨论】:
-
C 中没有 %% 这样的运算符。看来您的意思是逻辑 AND 运算符 &&。
标签: c error-handling cs50