1.打印上三角矩形
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n = (1e10 - 1)/9;
for (int i=0; i<10; i++ )
{
printf("%010d\n",n);
n /=10;
}
}
![](http://static.javashuo.com/static/loading.gif)
2.打印下三角矩形
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n =1e9;
for (int i=0; i<10; i++ )
{
printf("%010d\n",n);
n = 1e9 + n/10;
}
}
![](http://static.javashuo.com/static/loading.gif)
3.輸出abc,bcd,cde
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n = 0x00636261;/// 0x 後的 0 是告訴 字符串的結束 "\0" 的 ansi
for (int i=0; i<3; i++)
{
printf("%s\n",(char*)&n);/// &n 的類型是 int * ,強制轉化爲 char * 對應於%s,本來就是一個指針
n += 0x00010101;
}
return 0;
}
![](http://static.javashuo.com/static/loading.gif)