
C
大道殊同
野生程序员
展开
-
freopen函数
FILE *freopen( const char *path, const char *mode, FILE *stream );path:文件名,用于存储输入输出的自定义文件名。mode:文件打开的模式。和fopen中的模式(如r-只读, w-写)相同。stream:一个文件,通常使用标准流文件。返回值:成功,则返回一个path所指定文件的指针;失败,返回NULL。...原创 2020-06-07 17:45:07 · 2244 阅读 · 0 评论 -
C的类实现方法
C的结构体中只能放数据,而不能放函数。但可以通过函数指针,间接在结构体中实现函数操作。#include<stdio.h>struct PRINTF{ void(*P)(int a);};void Printf(int a);int main(){ struct PRINTF p; p.P = Printf; p.P(2); s...原创 2018-05-01 22:39:35 · 1406 阅读 · 0 评论 -
C语言对Excel操作
C语言对Excel操作转载 2017-08-06 00:07:20 · 5646 阅读 · 0 评论 -
时间函数
头文件#include<time.h>clock_t start,stop;double t;start=clock();//函数stop=clock();t=(double)(stop-start)/CLK_TCK;原创 2017-09-04 21:38:39 · 195 阅读 · 0 评论 -
数组与指针
//数组与指针的关系 #includevoid PRINT(int P[][31]){ for(int i=0; i 12; i++) { for(int j=0; j 31; j++) printf("%d ",P[i][j]); printf("\n"); }}main(){ int c原创 2018-01-30 22:22:36 · 143 阅读 · 0 评论 -
动态分配内存
//以字节为单位进行内存分配 1.void* malloc(unsigned int size);//分配长度size的连续空间。 2.void* calloc(unsigned int n, unsigned int size);//分配n个长度为size的连续空间。 3.void* realloc(void* pt, unsigned int newsize);//pt是已经分配的内存空...原创 2018-02-02 14:24:30 · 301 阅读 · 0 评论 -
int 64位的定义
int 64位的定义转载 2018-02-04 21:43:31 · 4764 阅读 · 0 评论 -
C语言输入输出语句
一:控制台输入输出 (1)字符数据的输入/输出 字符输出 putchar(ch); 字符输入 getchar(ch); (2)格式化输入/输出 格式输出 printf(“格式控制字符串”,输出列表); 格式输入 scanf(“格式控制字符串”,地址列表); (3)字符串的输...原创 2018-04-27 13:54:03 · 42138 阅读 · 0 评论 -
逻辑分析
#include<stdio.h>int counter = 0;void Print(int *ans){ int i; for (i = 1; i <= 10; i++) { printf("%d=%c\n", i, 'A' - 1 + ans[i]); } printf("\n");}int Judge...原创 2018-03-07 20:33:10 · 193 阅读 · 0 评论 -
贪吃蛇小游戏
#include&lt;stdio.h&gt;#include&lt;Windows.h&gt;#include&lt;stdlib.h&gt;#include&lt;time.h&gt;#define W_S_F "■" //地图&amp;&amp;蛇&原创 2018-04-10 11:18:15 · 225 阅读 · 0 评论 -
链表练习
#include<iostream> #include<cmath>#include<string.h> #include<cstdio>#include<stdlib.h>#define LEN sizeof(struct stu)#define LL long longusing namespace std;struct stu{ int num; struct原创 2017-04-18 13:08:43 · 230 阅读 · 0 评论