C
文章平均质量分 62
g33_N
这个作者很懒,什么都没留下…
展开
-
通讯录(实现文件的写入,加载)
#define _CRT_SECURE_NO_WARNINGS #include"contact.h" void menu()//菜单 { printf("\n******************************************************\n"); printf("\n************************通讯录******************原创 2016-08-12 20:34:29 · 390 阅读 · 0 评论 -
C语言模式实现C++继承和多态
C实现一个struct A和struct B各包含一个int成员a和b,要求达到B继承了A的效果,也就是B里面包含一个A。并且能达到多态的效果,也就是一个A*p指向A调的是A的函数,指向B调用的是B的函数何为继承 ? 定义:在C++中所谓的继承就是在一个已存在的类的基础上建立一个新的类。已存在的类称为“基类”或者“父类”,新建立的类称为“派生类”或者“子类”,一个新类从已有的类那里获得其已有特性,原创 2017-07-28 18:51:50 · 599 阅读 · 0 评论 -
C和指针读书笔记(第四章、第五章)
一、语句 1.break和continue的区别 break表示结束整个循环体,循环不再执行; continue表示结束本次循环,程序接着执行下一次循环; 2.continue在for语句中和while语句中的区别: 当出现continue时,在for语句中,continue直接跳过循环体的剩余部分,来到调整部分,但是在while语句中,调整部分是循环体的一部分,cont原创 2016-07-19 17:37:48 · 243 阅读 · 0 评论 -
高质量C和C++编程 读书笔记 (第一二章)
一、文件结构 1.版权和版本的声明:位于头文件分定义文件的开头 包括:版权信息 文件名称,标识符,摘要 当前版本号,作者、修改者原创 2016-07-21 17:54:47 · 311 阅读 · 0 评论 -
strcpy,strncpy,strcat,strchr,strstr等字符串函数相关用法
点击链接查看 http://www.kuqin.com/clib/string/strchr.html转载 2016-07-23 14:24:34 · 671 阅读 · 0 评论 -
棋盘游戏(三子棋)
棋盘游戏(三子棋) #include #include #include enum op { EXIT, PLAY }; void menu() { printf("*****************************************\n"); printf("***************棋盘游戏****************\n"); print原创 2016-07-23 14:27:33 · 621 阅读 · 0 评论 -
模拟实现strcmp,strncmp,strstr,strcat,strncat,strcpy,strncpy,strlen ,memcpy,memmove等函数
1.模拟实现strlen函数 #include #include #include int my_strlen(const char *str)//循环 { int count = 0; assert(str); while(*str)//遍历字符串,用计数器计数 { count++; str++; } return count; } int my_strlen(c原创 2016-08-03 22:08:57 · 821 阅读 · 0 评论 -
实现一个选择排序程序,排序整型数组
//实现一个选择排序程序,排序整型数组。 #include #include void select_sort(int arr[],int n) { int k =0 ; int i =0; int j = 0; for(i=0;i { k=i; for( j=i+1;j { if(arr[j] k = j; } if(k!=i) { int temp = ar原创 2016-08-04 23:57:28 · 685 阅读 · 0 评论 -
简易计算器(函数指针数组)
#include #include int Add(int a, int b) { return a + b; } int Sub(int a, int b) { return a - b; } int Mul(int a, int b) { return a*b; } int Div(int a, int b) { return a / b; } //封装加原创 2016-08-05 21:40:16 · 384 阅读 · 0 评论 -
C语言通讯录
#include #include #include typedef struct ATNN //定义结构体 { char name[20]; char sex[4]; char age[3]; char tel[12]; char addr[50]; } Attn; void menu()//菜单 { printf("\n************************原创 2016-08-07 20:23:04 · 214 阅读 · 0 评论 -
C与C++注释转换
CommentConvert.h内容 #ifndef __COMMENT_CONVERT_H__ #define __COMMENT_CONVERT_H__ #include #include enum STATE//枚举操作选项 { NULL_STATE, //普通语句 C_STATE, //C 模式 CPP_STATE, //cpp 模式原创 2016-08-12 20:26:45 · 393 阅读 · 0 评论 -
通讯录动态开辟版本
contact.h #include #include #include #ifndef _CNTACT_H_ #define _CNTACT_H_ #define NAME_MAX 20 #define SEX_MAX 4 #define TEL_MAX 12 #define ADDR_MAX 50 #define DEFAULT_SZ 10 #define原创 2016-08-12 20:28:58 · 299 阅读 · 0 评论 -
斐波那契函数
1,数组(长度有限) #include #include int main() { int arr[20] = {1,1}; int i= 0; for(i=2;i { arr[i]=arr[i-1]+arr[i-2]; } for(i=0;i { if(i%5==0) printf("\n"); printf("%8d",arr[i]); } printf("\原创 2016-07-31 23:02:10 · 625 阅读 · 0 评论