惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - Fei飞

关于下划线的有无,和超链接的颜色变化 Action里跳转到错误页的另一种方法(struts1.2) - Fei飞 - 博客园 java获取本机IP - Fei飞 - 博客园 jdk环境变量 Tomcat虚拟路径 - Fei飞 - 博客园 杨辉三角的画法(c语言) - Fei飞 - 博客园 完成SSh构架的搭建 js表单验证控制代码大全 颜色编码表 mysql中文配置 js实现按钮控制加减 Could not execute JDBC batch update 用js获取select所选的值 struts中,防止F5刷新,造成重复投票方法 我是大海里的一页扁舟 类型转换和页面获取值(总爱忘的) JDBCTM中Statement接口提供的execute、executeQuery和executeUpdate之间的区别 html标签大全 struts标签库
C的错误分析
Fei飞 · 2008-03-15 · via 博客园 - Fei飞

#include<stdio.h>

void main()
{
write:char a;
printf("请输入一个小写字母:");

a=getchar();

    if(a<97||a>122){
        printf("错误,您输入的不是小写字母!!!\n");
        getchar();//(1)
        goto write;
    }
    else{
        printf("相应的大写形式:");
        putchar(a-32);
        printf("\n");
    }
}
//开始我没有加(1)处的getchar();
结果输入一个不是小写字母的时候,"错误,您输入的不是小写字母!!!“写了两遍,加上(1)处的getchar()后就没有了这种情况,这是因为,当你输入一个不是小写字母的东东的时候,比如说"1",然后按回车,a实际上就装上了两个字符,"1"和回车,但是getchar()只是获得一个字符,那么a只能得到一个字符,另一个储存在缓存里,这两个都不是小写字母,所以要经过两次if语句,这时加上(1)处getchar()就获取了缓存里的字符,这样可以了。
(此程序的缺陷:不能输入多个字符,比如"123")