task1
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <windows.h> #define N 80 void print_text(int line, int col, char text[]); void print_spaces(int n); void print_blank_lines(int n); int main() { int line, col, i; char text[N] = "hi, November~"; srand(time(0)); for (i = 1; i <= 10; ++i) { line = rand() % 25; col = rand() % 80; print_text(line, col, text); Sleep(1000); } return 0; } void print_spaces(int n) { int i; for (i = 1; i <= n; ++i) printf(" "); } void print_blank_lines(int n) { int i; for (i = 1; i <= n; ++i) printf("\n"); } void print_text(int line, int col, char text[]) { print_blank_lines(line - 1); print_spaces(col - 1); printf("%s", text); }
作用:
task2
task3
#include <stdio.h> long long func(int n); int main() { int n; long long f; while (scanf_s("%d", &n) != EOF) { f = func(n); printf("n = %d, f = %lld\n", n, f-1); } return 0; } long long func(int n) { if (n == 0)return 1; else return 2 * func(n - 1); }
task4
标签:int,text,long,实验,func,print,include From: https://www.cnblogs.com/liangchenxi/p/16858805.html