帮助我验证输入 [英] Help me on validating input
本文介绍了帮助我验证输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何编写30个字符的字符串作为输入的程序。只允许使用字母。除了空格符号和点符号不允许其他符号。不允许使用数字。在......
我想要用C语言编写上述问题的程序。
解决方案
你可以接受一个字符串作为输入来自用户(例如通过 scanf
)然后使用给定的约束验证它(例如检查字符串是否太大,搜索无效字符等等)。
How Do I Write A Program Where A String Of 30 Characters Is Given As Input .Only Alphabets Are Allowed .Except Space Symbol And Dot Symbol No Other Symbols Are Allowed.Numbers Are Not Allowed.In...
I want a program for the question written above in C language.
解决方案
You coud accept a string as input from the user (e.g. via scanf
) and then validate it applying the given constraints (e.g. check if the string is too big, search for invalid characters and so on).
这篇关于帮助我验证输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文