标签:load can class bsp utc char com alt ++
1、
#include <stdio.h> void put(char x[], int n) { while(n-- > 0) printf(x); putchar(‘\n‘); } int main(void) { char str[128]; int n; printf("str: "); scanf("%s", str); printf("n : "); scanf("%d", &n); puts("\n==========="); put(str, n); return 0; }
2、
#include <stdio.h> void put(char x[], int n) { while(n-- > 0) { int i = 0; while(x[i]) putchar(x[i++]); } putchar(‘\n‘); } int main(void) { char str[128]; int n; printf("str: "); scanf("%s", str); printf("n : "); scanf("%d", &n); puts("\n=================="); put(str, n); return 0; }
3、
#include <stdio.h> void put(char x[], int n) { int i; for(i = 0; i < n; i++) { int j = 0; while(x[j] != ‘\0‘) { putchar(x[j]); j++; } } putchar(‘\n‘); } int main(void) { char str[128]; int n; printf("str: "); scanf("%s", str); printf("n : "); scanf("%d", &n); puts("\n============"); put(str, n); return 0; }
标签:load can class bsp utc char com alt ++
原文地址:https://www.cnblogs.com/liujiaxin2018/p/14812937.html