![](https://img-blog.csdnimg.cn/20190429232136201.jpeg?x-oss-process=image/resize,m_fixed,h_224,w_224)
有趣的代码
本专栏会更新一些本人认为有趣的代码段
好雨知时节呀
热爱分享,热爱生活
展开
-
C语言中格式化输出 %5.3s 的结果说明
在输出函数中 %s 为字符格式符,那么我们来看看以下的例子:#include <stdio.h>int main(){ printf("%6.5s", "computer"); printf("%5.3s\n", "computer"); printf("%s\n", "computer"); return 0;}输出结果:我们发现, %6.5s 输出为六列,五...原创 2019-05-22 17:07:29 · 8721 阅读 · 1 评论 -
如何在C / C ++中不使用分号打印分号(;)?
方式一:在if语句中使用printf / putchar#include <stdio.h> int main() { // ASCII 分号的值为59 if (printf("%c\n", 59)) if (putchar(59)) { } printf("\n"); return 0; } 方式二:使用宏#include <stdio...原创 2019-06-01 15:32:46 · 381 阅读 · 0 评论 -
不使用循环和递归打印100次1
#include <iostream>using namespace std;#define a cout<<"1"<<endl; #define b a a a a a a a a a a #define c b b b b b b b b b b int main(){ c; return 0;}原创 2019-06-01 15:20:29 · 320 阅读 · 0 评论