C程序设计
weiabc
外行学编程
展开
-
2021-08-26写入乘法表到文件
#include <stdio.h> int main(int argc, char const *argv[]) { FILE* file; file = fopen("a.txt","w+"); for (int i = 1; i <= 9; i++) { for (int j = 1; j <= i; j++) { fprintf(file,"%d*%d=%d\t", j, i, i*j); printf("%d*%d=%d\t", j, i,.原创 2021-08-26 09:40:58 · 169 阅读 · 0 评论 -
2021-08-17 C语言getchar() 与 putchar()
#include <stdio.h> /* copy input to output; 1st version */ int main() { int c; c = getchar(); while (c != EOF) { putchar(c); c = getchar(); } return 0; }原创 2021-08-17 22:27:38 · 177 阅读 · 1 评论 -
2021-08-17 C语言 for 语句
#include <stdio.h> #define LOWER 0 #define UPPOR 300 #define STET 20 int main(int argc, char const *argv[]) { int fahr; for (fahr = LOWER; fahr <= UPPOR; fahr += 20) { printf("%3d %6.1f\n", fahr, (5.0 / 9.0) * (fahr - 32)); } return .原创 2021-08-17 22:05:31 · 82 阅读 · 0 评论 -
2021-08-17C语言的格式化输出
#include <stdio.h> int main(int argc, char const *argv[]) { int hs = 0; float ss = 0; for (int i = 0; i < 16; i++) { hs = i * 20.0; ss = 5.0 / 9.0 * (hs - 32.0); printf("%3.0f\t%6.1f\n", hs, ss); } return 0; } 说明:上面程序中 int hs = 0;..原创 2021-08-17 18:11:41 · 339 阅读 · 0 评论 -
第一个C程序
#include <stdio.h> main(int argc, char const *argv[]) { printf("中国,你好"); }原创 2021-08-17 18:02:22 · 113 阅读 · 0 评论