GTim
2018-11-22 20:29:36 +08:00
```
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int level(int l)
{
return l == 1 ? 1 : level(l-1)+1;
}
int main()
{
char ch;
int a,b=1;
printf("Study is a long and hard road.\n");
printf("The more you study,the further you will reach.\n");
printf("Such as if you learn 1 year, you will reached level %d.\n",level(1));
do {
b=b+1;
printf("such as if you learn %d years, you will reached %d level.\n",
b,level(b));
printf("do you want to continue?(y/n).\n");
ch=getchar();
getchar();
} while(ch == 'y'|| ch== 'Y');
}
```
测试格式化代码
以上是楼主代码的简化和想要的版本