摘要:1 #include <stdio.h> 2 3 4 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 /*输出数据1 换行2 输出数据2 ;计
阅读全文
随笔分类 - C
摘要:1 #include <stdio.h> 2 3 4 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 /*输出数据1 换行2 输出数据2 ;计
阅读全文
摘要:C C++比较: 1. Scanf printf 函数 Cin cout可不指定输入输出格式,消耗时间多 2. Stdio :standard input output .h——head Stdio.h ——include sth about input and output (cstdio) #i
阅读全文
摘要:线性表顺序存储结构: 线性表的顺序存储结构,指的是永一段地址连续的存储单元 1.定义线性表的最大存储空间 #define MAX_SIZE 255 2.线性表中有同一类型的元素集合 typedef int ElemType ; typedef struct{ int id, char * name;
阅读全文
摘要:定义:零个或多个数据元素的有限序列 特点: 它是一个序列 。数据元素之间是有序的 。数据元素是一对一的关系 有限性 。线性表中数据元素的个数是有限的 。零个元素的有限序列被称为空表 线性表的常见操作:(增删改查) 创建和初始化(排队),查找(寻找),插入,删除,清空 ADT 线性表(Sequence
阅读全文
摘要:(1)产生50个随机数 (2)按一行10个数的形式输出: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* run this program using the console pauser or add your own getch, system
阅读全文
摘要:求1+2!+3!+.......+n! 代码; 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* run this program using the console pauser or add your own getch, system("pau
阅读全文
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 5 void main(){ 6 int i; 7 scanf("%d",&i); 8 switch(i){ 9 case 1:printf("i=%d*\n",i);break; 10 case 2:pr
阅读全文
摘要:1.void和int表示的是主函数的返回值,void返回的是空值,int返回的是一个整型数值。用的是int main,在程序结束时必须写上return 0(或者任何一个整数);而用的是void main就不需要return返回语句。 2.void main 和 int main的区别就是有无返回值在
阅读全文
摘要:解数学方程 1.辗转相除法 2.计算机凑一个数比找一个方法更容易(暴力破解法) 3.二分法 4.指针是C语言的灵魂 5.iso国际标准化组织; ios苹果操作系统
阅读全文
摘要:1001 A+B Format 题目:Calculate a+b and output the sum in standard formatthat is,the digits must be seperated into groups of three by commas (unless ther
阅读全文
摘要:题目:1.简单选择排序:将输入的若干个整数按简单选择排序算法从小到大排序,数据从数组的1单元放起: 1 #include <stdio.h> 2 #define MAXSIZE 100 3 typedef struct { 4 int key; 5 }RECNODE; 6 7 void seleso
阅读全文
摘要:1 #include <stdio.h> 2 #include <malloc.h> 3 typedef struct node1{ 4 char data; 5 struct node1 *lchild,*rchild; 6 }node1,BTCHINALR; 7 8 BTCHINALR *cre
阅读全文
摘要:1.C语言sprintf()函数:将格式化的数据写入字符串 sprintf()最常见的应用之一莫过于把整数打印到字符串中,如: sprintf(s, "%d", 123); //把整数123打印成一个字符串保存在s中 sprintf(s, "%8x", 4567); //小写16进制,宽度占8个位置
阅读全文
摘要:题目: 1.数制转换(非负数十进制整数转换为八进制数) 方法一:非递归实现 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* run this program using the console pauser or add your own getc
阅读全文
摘要:一.实验目的 熟练掌握线性表的基本操作在顺序表存储结构上的实现。 二.主要仪器及耗材: 普通计算机 三。实验内容: 1.在有序表种插入一个元素并保持该表任然有序。 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* run this program u
阅读全文
摘要:题目:写一个程序PrintN,使得传入一个正整数为N的参数后,能依次打印出从1到N 的全部正整数。 方法一:(循环) 方法二(递归): 在循环和递归都能执行小数据的情况下,测试成功! 当:输入的数据为100 0000时,递归算法 非正常终止! 测试如下: (一)循环为test,编译器为OPEN: 输
阅读全文
摘要:调用C中的函数: 打印从1到N的数: 注:被调用的函数的位置:一定要放在main()主函数的前面!(在Ubuntu中测试的情况) 测试成功! 补充: 如果将被调函数和主函数的位置交换,则在Ubuntu中代码报错: 则出现变量无法识别的情况。
阅读全文
摘要:打印出较大的数: 打印一个数的绝对值: 给学生成绩分批打等地: 由学生等地求学生成绩范围: 注:case 后面括号里面的限制未单引号!
阅读全文
|