
C
ZhongQi0808
菜鸟码农
展开
-
C语言 括号匹配问题
定义一个计数器用来判断正反括号的数量,遇见 { 则count+1,当遇见count不为0且当前字符为 } 时,count--若count=0且当前字符为 } 时括号一定不匹配,循环直到EOF,判断count值来知道括号是否匹配#include int main(){ int ch; int count=0; while( (ch=getchar()) != EOF )原创 2015-03-18 16:31:22 · 5917 阅读 · 0 评论 -
C语言 6个变态的Hello World程序
下面的六个程序片段主要完成这些事情:输出Hello, World混乱C语言的源代码下面的所有程序都可以在GCC下编译通过,只有最后一个需要动用C++的编译器g++才能编程通过。hello 1:#define _________ } #define ________ putchar #define _______ main #define _(转载 2015-04-14 17:43:03 · 800 阅读 · 0 评论