本文介绍了如何扫描的空间变成一个字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在1-3字扫描从用户到一个字符串。但是,只有第一个字扫描。
解决方案
scanf函数(%S,&安培;区);
scanf函数
停止从流中读取遇到空当。您需要使用来代替。
I am trying to scan in 1-3 words from the user into a string. However, Only the first word will scan.
解决方案
scanf("%s", &area ) ;
scanf
stops reading from the stream when a space is encountered. You need to use getline instead.
这篇关于如何扫描的空间变成一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!