04 2015 档案

摘要:从头到尾异或一遍,你就得到了需要求的两个数异或后的值。这两个数显然不相等,异或出来的结果不为0。我们可以据此找出两个数的二进制表达中不同的一位,然后把所有这n个数分成两类,在那一位上是0的分成一类,在那一位上是1的分到另一类。对每一类分别使用前一个问题的算法 1 #include 2 #inclu... 阅读全文
posted @ 2015-04-30 08:12 码农@163 阅读(634) 评论(0) 推荐(0)
摘要://有101个数,其中有50个数出现了两次,有一个数只出现了一次,找出出现一次的数#include #include int main(){ int a[11] = {0}; int i; int n = 0; printf("please input the arr :")... 阅读全文
posted @ 2015-04-30 08:11 码农@163 阅读(1308) 评论(0) 推荐(0)
摘要:全包含在:conio.h中clrscr:控制台程序清屏!光标回到1,1点voidclrscr(void);textbackground:选择一种新的文本背景色voidtextbackground(intnewcolor);textmode:将屏幕设置为文本模式voidtextmode(intnewm... 阅读全文
posted @ 2015-04-27 20:24 码农@163 阅读(1227) 评论(0) 推荐(0)
摘要:文件的操作标准流stdin 标准输入流 stdout 标准输出流 stderr 标准错误流FILE 文件位置指示符 错误指示符 文件结束指示符1,提高速度 使用文件指针2 文件指针与磁盘文件建立联系,以后对文件操作都将通过文件指针来进行。 fopen(文件名,使用文件方式) 文件打开不成... 阅读全文
posted @ 2015-04-18 16:23 码农@163 阅读(266) 评论(0) 推荐(0)
摘要:1 #include "stdafx.h" 2 #include 3 #include 4 #define N 80 5 int CopyFile(const char *srcName,const char *dstName); 6 int main() 7 { 8 char src... 阅读全文
posted @ 2015-04-18 11:21 码农@163 阅读(735) 评论(0) 推荐(0)
摘要:1 #include "stdafx.h" 2 #include 3 #include 4 #define N 30 5 typedef struct date 6 { 7 int year; 8 int month; 9 int day;10 }DATE;11 typ... 阅读全文
posted @ 2015-04-18 10:52 码农@163 阅读(296) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include typedef struct date{ int year; int month; int day;}DATE;typedef struct student{ long studentID; ch... 阅读全文
posted @ 2015-04-18 09:31 码农@163 阅读(1435) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include struct student{ char name[10]; int num; int age; char addr[40];};student s1[2],s2[2],*p1,*p2;int main... 阅读全文
posted @ 2015-04-17 16:37 码农@163 阅读(680) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #includeint main(){ FILE *fp; char ch; char *str = "www.cskaoyan.com"; if(fopen_s(&fp,"ReadMe.txt","at+") != N... 阅读全文
posted @ 2015-04-17 15:39 码农@163 阅读(218) 评论(0) 推荐(0)
摘要:文件的操作1,提高速度 使用文件指针2 文件指针与磁盘文件建立联系,以后对文件操作都将通过文件指针来进行。 fopen(文件名,使用文件方式) 文件打开不成功 将返回一个空指针NULL 文件使用方式 r w rb wb fgetc() getc() 从指定文件中一次读取一个字符 ... 阅读全文
posted @ 2015-04-17 14:52 码农@163 阅读(160) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include int main(){ FILE *readfile,*writefile; char ch; fopen_s(&readfile,"ReadMe.txt","r"); fopen_s(&writef... 阅读全文
posted @ 2015-04-17 14:36 码农@163 阅读(334) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include const int MAXN = 1000 + 10;int n, target[MAXN];int main(){ while(scanf_s("%d",&n,sizeof(n)) == 1) { ... 阅读全文
posted @ 2015-04-17 09:41 码农@163 阅读(147) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include const int MAXN = 50;int queue[MAXN];int main(){ int n,front,rear; scanf_s("%d",&n,sizeof(n)); for(int i ... 阅读全文
posted @ 2015-04-17 09:06 码农@163 阅读(128) 评论(0) 推荐(0)
摘要:1.局部变量通常在它所在的语句块结束的时候被释放。如果你不想释放某个局部变量,可以在局部变量上加上static进行声明2.C中有三种内存领域的寿命。q静态变量的寿命从程序运行时开始,到程序关闭时结束。q自动变量的寿命到声明该变量的语句块执行结束为止。q通过malloc()分配的领域的寿命到调用fre... 阅读全文
posted @ 2015-04-16 22:28 码农@163 阅读(247) 评论(0) 推荐(0)
摘要:1,传递给函数的标量参数是传值调用的2.传递给函数的数组参数在行为上就像它们是通过传地址调用的那样3. ADT 可以限制函数和数据定义的作用域---黑盒设计3.限制对模块的访问时用过static 关键字的合理使用实现的,它可以限制对那些并非接口的函数和数据的访问4.递归的两个条件:1,存在限定条件 ... 阅读全文
posted @ 2015-04-16 11:47 码农@163 阅读(301) 评论(0) 推荐(0)
摘要:1)求字符串长度 直接 while(*string++) 判断即可2)while((string = *string++) != NULL) a,把strings当前所指向 指针复制到变量string 中。 b,增加strings的值,使它指向下一个值 c.它测试string 是否为空。3) 阅读全文
posted @ 2015-04-14 23:21 码农@163 阅读(128) 评论(0) 推荐(0)
摘要:1 #include "stdafx.h" 2 #include 3 #include 4 #include 5 #define MAX_REMIND 50 6 #define MSG_LEN 60 7 int read_line(char str[],int n); 8 int main(... 阅读全文
posted @ 2015-04-14 15:54 码农@163 阅读(318) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include typedef struct stack{int data;struct stack *next;}STACK;STACK *head,*pr;int nodeNum = 0;STACK *Createnote(int num... 阅读全文
posted @ 2015-04-14 08:40 码农@163 阅读(155) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include #include #include typedef struct card{char suit[10];char face[10];}CARD;void Deal(CARD *wCard);void shuffle(CARD ... 阅读全文
posted @ 2015-04-13 23:01 码农@163 阅读(320) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include #include #define NUM_ELECTORATE 10#define NUM_CANDIDATE 3struct candicate{char name[20];int count;}candidate[3] =... 阅读全文
posted @ 2015-04-13 22:21 码农@163 阅读(177) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include #include void InputScore(int *p,int m,int n);int FindMax(int *p,int m,int n,int *pRow,int *pCol);int main(){int *... 阅读全文
posted @ 2015-04-13 21:02 码农@163 阅读(432) 评论(0) 推荐(0)
摘要:include "stdafx.h"#include #include #include #define N 10void Swap(int *x,int *y);void Transpose(int a[][N],int n);void InputMatrix(int a[][N],int n);... 阅读全文
posted @ 2015-04-13 20:33 码农@163 阅读(216) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include #include int main(){int n;static char * monthName[] = {"Illegal month","January","February","March","April","May"... 阅读全文
posted @ 2015-04-13 20:11 码农@163 阅读(344) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include #include #define N 100void Insert(char s[]);int main(){char str[N];printf_s("input a string:");gets_s(str);Insert... 阅读全文
posted @ 2015-04-13 16:47 码农@163 阅读(437) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include void Squeeze(char s[],char c);int main(){char str[20],ch;printf_s("input a string:");gets_s(str);printf_s("input ... 阅读全文
posted @ 2015-04-13 16:20 码农@163 阅读(147) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include float fun1(float x);float fun2(float x);float Integral(float (*f)(float),float a,float b);int main(){float y1,y2;... 阅读全文
posted @ 2015-04-13 16:15 码农@163 阅读(156) 评论(0) 推荐(0)
摘要:#include "stdafx.h"#include #include int DayofYear(int year,int month, int day);void MonthDay(int year,int yearDay,int *pMonth,int *pDay);void Menu(vo... 阅读全文
posted @ 2015-04-13 15:58 码农@163 阅读(315) 评论(0) 推荐(0)
摘要:输入某一年 以及某一年的天数 就 是几月的第几天#include "stdafx.h"#include #include int Monthday(int year,int yearDay,int *pMonth,int *pDay);int dayTab[2][13] = {{0,31,28,31... 阅读全文
posted @ 2015-04-13 15:19 码农@163 阅读(336) 评论(0) 推荐(0)