首页 > 代码库 > C快速复习
C快速复习
#include <stdio.h> #include <stdbool.h> int main(void) { float input; bool isTrue = (scanf("%f",&input) == 1); while(isTrue) { printf("it‘s %.d\n",(int)input);//输入的小于1就不会打印出来 isTrue = (scanf("%f",&input) == 1); } }
/*当只需获取一个输入时,可以向下面的这样做*/ #include <stdio.h> int main(void) { char boop; while(scanf("%c",&boop) == 1) { while(getchar() != ‘\n‘) continue; printf("It‘s %c",boop); } } //等同于下面的程序 #include <stdio.h> int main(void) { char boop; while(gets(&boop)) { printf("It‘s %c",boop); } }
本文出自 “天才的实力” 博客,转载请与作者联系!
C快速复习
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。