c - 如何检查用户在我的字符中输入的多个字符?
问题描述
do{
char reply;
printf("Enter your choice > ")
scanf("%c", &reply)
if (isdigit(reply) != 0){
//inside are my contents not really important
//what I want to ask is, if user input 123, because it is a char, hence 1 will be taken but it is a wrong input. How can i check it and print a "invalid input"?
}
}while (reply != 3)
解决方案
推荐阅读
- r - 在 R Studio 中使用 rep 函数
- mysql - 是否有可能在我的查询中添加 LIMIT 会使其变慢?
- python - pip 安装 MySQL-python 安装失败
- c# - using XmlSerializer with unknown root element
- css - Wordpress 背景图像未显示 - 在 Chrome 检查器中显示为灰色
- java - Java Spring:存储渲染的 HTML/JSP
- java - Swagger OpenAPI 3.0 - Springdoc - GroupedOpenApi 在 Spring MVC 中不起作用
- javascript - 尽管已触发挂载事件,为什么我的 Vue 应用程序不呈现?
- math - 线性公式计算
- php - 如何创建日期格式UTC php