Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UVa10082.cpp #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update UVa10082.cpp #15

wants to merge 1 commit into from

Conversation

xiafrog
Copy link

@xiafrog xiafrog commented Oct 25, 2016

No description provided.

@@ -5,7 +5,7 @@ char s[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
int main() {
int i, c;
while((c = getchar()) != EOF) {
for (i=1; s[i] && s[i]!=c; i++); // 找错位之后的字符在常量表中的位置
for (i=1; s[i]!=0 && s[i]!=c; i++); // 找错位之后的字符在常量表中的位置

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在C的逻辑判断,非0值为真,所以这边if(s[i])等价if(s[i] != 0),同理if(!x)等价if(x==0)
不过用if(s[i] != 0)更直观

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants