注册 登录
编程论坛 C语言论坛

vc++6.0重复输出一串文字

c菜鸟级选手 发布于 2021-10-28 19:41, 1243 次点击
那位大佬给写个重复输出100遍的  我爱编程
跪求
#include <stdio.h>
int main()

[此贴子已经被作者于2021-10-28 19:42编辑过]

1 回复
#2
自由而无用2021-10-28 20:05
//online parser: https://www.bccn.net/run/
程序代码:
#include <stdio.h>

static int idx;

#define c_string "c language yyds!"
#define __V_PRINT printf("%03d:%s\n", ++idx, c_string)
#define V_PRINT(st) st;st;st;st;st;st;st;st;st;st;

int main(int argc, char *argv[])
{
    V_PRINT(V_PRINT(__V_PRINT));
   
    return 0;
}


output sample:
001:c language yyds!
002:c language yyds!
003:c language yyds!
......
098:c language yyds!
099:c language yyds!
100:c language yyds!

reference:
https://blog.

[此贴子已经被作者于2021-10-28 20:15编辑过]

#3
hrpzcf2021-10-28 20:42
常规版
程序代码:
#include <stdio.h>

int main(void)
{
    char *s = "我爱编程";
    for (int i = 0; i < 100; ++i)
        printf("%s\n", s);
    return 0;
}
1