c++ scanf函数

本文介绍了C++中的scanf函数,重点讲解了其对输入字符的处理方式。当遇到空白字符时,函数会忽略直至遇到非空白字符。单个空格在格式字符串中表示匹配任意数量的空格。非空白字符必须在输入流中找到匹配,否则函数失败。格式说明符(%)用于指定从流中读取的数据类型和格式。
摘要由CSDN通过智能技术生成

官方介绍 http://www.cplusplus.com/reference/cstdio/scanf/

C string that contains a sequence of characters that control how characters extracted from the stream are treated:

Whitespace character: the function will read and ignore any whitespace characters encountered before the next non-whitespace character (whitespace characters include spaces, newline and tab characters – see isspace). A single whitespace in the format string validates any quantity of whitespace characters extracted from the stream (including none).

Non-whitespace character, except format specifier (%): Any character that is not either a whitespace character (blank, newline or tab) or part of a format specifier (which begin with a % character) causes the function to read the next character from the stream, compare it to this non-whitespace character and if it matches, it

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值