09 2021 档案
摘要:#include<stdio.h>#include<iostream>#pragma warning(disable : 4996) int main(){ FILE *fp1, *fp2; fp1 = fopen("a.txt", "r"); fp2 = fopen("b.txt", "w");
阅读全文
摘要:char cmd[100];//容纳cmd的字符串变量。 sprintf_s(cmd, "taskkill /im %s", "ttermpro.exe");//cmd的结果为"taskkill /im taska" system(cmd);//通过变量,调用system。
阅读全文
摘要:// Project15.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。//#pragma warning (disable:4996)#include<stdio.h>#include<string.h>#include<malloc.h> //浅拷贝,多个指针只想一个内
阅读全文
摘要:// 菲薄纳西数列 0 1 1 2 3 5 8 13 . . . long Fib(int i){ if (i == 0) return 0; if (i == 1) return 1; return Fib(i - 1) + Fib(i - 2);} int main(){ for (size_t
阅读全文
摘要:long long jieCheng(size_t i){ if (i <= 1) return 1; return (i * jieCheng(i - 1));}int main(){ int i= 8; long long res = jieCheng(i); printf("%ld", res
阅读全文
摘要://memcpyint main01(){ const char str[50] = "www.google.com"; char dest[50]; //遇到不熟悉的函数,按F1看微软的帮助文档, //memcpy(dest, str, strlen(str)+1); //memcpy(dest,
阅读全文
摘要://栈区 stack 编译器自动分配释放,存放函数的参数值,局部变量值等,比较小,与数据结构中的栈相似//堆区 heap,有程序猿分配释放,程序结束后可能由OS回收,与数据结构是两回事//数据区 data , 主要包括静态全局区和常量区,而局部变量在栈区,要与之区分。//代码区 Code:存放函数体
阅读全文
摘要:#include<stdio.h>#include<string.h>#include <stdlib.h> #pragma warning(disable : 4996) struct Student{ char name[20]; int num; int age; float scor;};i
阅读全文
摘要:#include<stdio.h>#include<string.h>#include <stdlib.h> #pragma warning(disable : 4996) int main(){ int a[5]; int b[5]; int size = sizeof(int); FILE *f
阅读全文
摘要:FILE *fp; char str[200] = { 0 }; char tmp[100]; fp = fopen("test.txt", "at+"); if (fp == NULL) { puts("文件打开失败\n"); } printf("请输入一个字符串\n"); gets(tmp);
阅读全文
摘要://fgets fputs FILE *fp; char str[100]; fp = fopen("test.txt", "rt"); if (fp == NULL) { puts("文件读取失败\n"); exit(0); } while (fgets(str, 100, fp) != NULL
阅读全文
摘要:#include<stdio.h>#include<string.h>#include <stdlib.h> #pragma warning(disable : 4996) int main() { //写文件 /*FILE *fileP = NULL; fileP = fopen("test.tx
阅读全文
摘要:#include<stdio.h>#include<string.h>#include <stdlib.h> #pragma warning(disable : 4996) //动态内存管理 //定义数组内存固定的,但是有时候数组不能确定个数,所以用动态内存 int main(int argc, c
阅读全文
摘要:#include<stdio.h>#include<string.h> typedef struct Books { char title[10]; char bookname[10]; char author[20]; int bookID;}Book; int main(int argc, co
阅读全文
摘要:#include<stdio.h>#include<string.h>#pragma warning(disable : 4996) typedef unsigned char BYTE;typedef int INT; BYTE B1, B2; INT a, b;
阅读全文
摘要:#include<stdio.h> //联合体union union Data{ int i; float f; char ch; }; int main(int argc, const char *argv[]){ union Data data1; data1.i = 1; data1.f =
阅读全文
摘要:#include<stdio.h> #include<string>struct Student{ int num; char name[20]; char sex; int age; float score; char address[30];}; int main() { // 利用指针对结构体
阅读全文
摘要:#include<stdio.h> #include<string> struct Student{ int num; char name[20]; char sex; int age; float score; char address[30];}; //结构体传带指针的参数 void Print
阅读全文
摘要:#include<stdio.h> #include<string>struct Student{ int num; char name[20]; char sex; int age; float score; char address[30];}; int main() { { struct St
阅读全文