摘要:
// 将file1.txt中小写字母转换成大写后,另存为file2.txt #include <stdio.h> #include <stdlib.h> int main() { FILE *fin, *fout; // 定义文件类型指针 int ch; fin = fopen("file1.txt 阅读全文
摘要:
#include <stdio.h> #include <stdlib.h> const int N=5; // 定义结构体类型struct student,并定义STU为其别名 typedef struct student { long no; char name[20]; int score; 阅读全文
摘要:
// 练习:使用二分查找,在一组有序元素中查找数据项 // 形参是数组,实参是数组名 #include <stdio.h> #include <stdlib.h> const int N=5; int binarySearch(int x[], int n, int item); // 函数声明 i 阅读全文
摘要:
//寻找两个整数之间的所有素数(包括这两个整数),把结果保存在数组bb中,函数返回素数的个数。 // 例如,输入6和21,则输出为:7 11 13 17 19。 #include <stdio.h> #include <stdlib.h> #define N 1000 int fun(int n,i 阅读全文
摘要:
// 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, r 阅读全文
摘要:
/* 《C语言程序设计教程学习指导》p118 实验内容(1) 这是一个常用格式控制符使用示例 运行程序,观察行结果,对照每一行printf()中的格式控制符,理解其功能和用法 */ #include int main() { int x=1234; float f=123.456; double m=123.456; char ch='a'; ch... 阅读全文
摘要:
#include<stdio.h> int main() { printf("201983270526\n"); printf("Hello Mars!"); return 0; } #include<stdio.h> int product(int,int); int main() { int x 阅读全文
摘要:
#include <stdio.h> int main () { int x; printf("输入一个整数:\n"); scanf("%d",&x); if(x%2!=0) printf("是奇数"); else printf("是偶数"); return 0; } #include <stdio 阅读全文
摘要:
#include int main() { printf("201983270526\n"); printf("Hello Mars!"); return 0; } #include int product(int,int); int main() { int x, y, s; scanf("%d %d", &x, &y); ... 阅读全文