摘要: FILE *fp; char str[200] = { 0 }; char tmp[100]; fp = fopen("test.txt", "at+"); if (fp == NULL) { puts("文件打开失败\n"); } printf("请输入一个字符串\n"); gets(tmp); 阅读全文
posted @ 2021-09-07 15:45 江南王小帅 阅读(50) 评论(0) 推荐(0)
摘要: //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 阅读全文
posted @ 2021-09-07 15:36 江南王小帅 阅读(36) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<string.h>#include <stdlib.h> #pragma warning(disable : 4996) int main() { //写文件 /*FILE *fileP = NULL; fileP = fopen("test.tx 阅读全文
posted @ 2021-09-07 15:31 江南王小帅 阅读(27) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<string.h>#include <stdlib.h> #pragma warning(disable : 4996) //动态内存管理 //定义数组内存固定的,但是有时候数组不能确定个数,所以用动态内存 int main(int argc, c 阅读全文
posted @ 2021-09-07 11:48 江南王小帅 阅读(61) 评论(0) 推荐(0)
摘要: #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 阅读全文
posted @ 2021-09-07 11:30 江南王小帅 阅读(31) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<string.h>#pragma warning(disable : 4996) typedef unsigned char BYTE;typedef int INT; BYTE B1, B2; INT a, b; 阅读全文
posted @ 2021-09-07 11:28 江南王小帅 阅读(30) 评论(0) 推荐(0)
摘要: #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 = 阅读全文
posted @ 2021-09-07 10:22 江南王小帅 阅读(342) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<string>struct Student{ int num; char name[20]; char sex; int age; float score; char address[30];}; int main() { // 利用指针对结构体 阅读全文
posted @ 2021-09-07 08:47 江南王小帅 阅读(33) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<string> struct Student{ int num; char name[20]; char sex; int age; float score; char address[30];}; //结构体传带指针的参数 void Print 阅读全文
posted @ 2021-09-07 08:44 江南王小帅 阅读(787) 评论(0) 推荐(0)
摘要: #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 阅读全文
posted @ 2021-09-07 08:42 江南王小帅 阅读(54) 评论(0) 推荐(0)