
C语言
pear_11
这个作者很懒,什么都没留下…
展开
-
2020-09-26
fstream open open(const char* p,mode); 参数一:char型指针或字符串 参数二:模式 参数二可以有也可以没有 fstream fs; string str; fs.open("data.txt"); open("d:\\data,txt") open(str.c_str()); // c_str() string转char getline原创 2020-09-26 14:58:09 · 101 阅读 · 0 评论 -
函数及其头文件
system(“cls”); //清屏函数,stdlib.h memset(name,’\0’,sizeof(name)); //数组清零函数,string.h原创 2020-08-08 09:28:50 · 253 阅读 · 0 评论 -
200726C的数据传递方式
原创 2020-07-26 23:25:57 · 101 阅读 · 0 评论 -
随机数生成函数
#include<time.h> #include<stdlib.h> int rd_num() { int res=0; //生成随机数 srand(time(NULL)); //种子函数:目的是生成产生随机数的种子,让生成的随机数不是固定的 res=rand()%3+1+48; //rand:生成随机数。rand()%3+1+48返回对应的ASCII码 return res; } ...原创 2020-07-24 22:26:19 · 970 阅读 · 0 评论 -
易错点
(float)sum/4和(float)(sum/4)不同 i=6;printf("%d\n",(i++)+(i++)); // 先6+6=12,后i=6+1=7,i=7+1=8。(i++)+(i++)->i+i->i=6+1=7->i=7+1=8。后面加 是指printf执行完以后 m=10;printf("%d\n",(++m)+(++m));先运算:m=10+1,m=11+1, 再使用:m+m->12+12=24 ...原创 2020-07-24 18:29:50 · 110 阅读 · 0 评论