![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++笔记
lz199057
这个作者很懒,什么都没留下…
展开
-
13南理工test01:进制转化
#include #include using namespace std; int main() { //cout int input; const int bite_num=20; while(1) { cout cin>>input; int num_form; /*while(input/2!=0) { input=input/2; bite_num++;/原创 2014-03-27 18:06:51 · 312 阅读 · 0 评论 -
回显
#include #include main() { int c; printf("getchar:"); c=getchar();//缓冲,回显. printf("%d",c); printf("\ngetch:"); c=getch();//不缓冲,不回显 printf("%d",c); printf("\ngetche:"); c=ge原创 2014-03-26 10:33:26 · 443 阅读 · 0 评论 -
get函数
1、int getc(FILE *stream); 从指定输入流 stream 的当前位置读取一个字符,若读到文件尾而无数据时便返回EOF。 main() { int c; FILE *fp= fopen("d:\\a.txt","r"); fpos_t p=4; fsetpos(fp,&p); c=getc(fp); putchar(c);转载 2014-03-26 10:48:33 · 815 阅读 · 1 评论 -
自然对数
#include #include using namespace std; void main() { int i,j; //cout while(1) { cout cin>>i>>j; int m=abs(i-j); int n=i+j; int a=(int)sqrt(m);//开不尽取整之后精度丢失。平方不等m int b=(int)sqrt(n); if原创 2014-03-27 18:18:20 · 457 阅读 · 0 评论 -
13test07;字符排序,去重,三三输出
#include #include using namespace std; void buddle(char*,int);//对输入字符的AScII进行排序 void delete_num(char*,int);//去除已排好顺序中重复的字符. int main() { while(1) { char s[30];//定义存储字符的字符数组。 string s1;//定义原创 2014-03-27 18:13:57 · 321 阅读 · 0 评论 -
各进制转化
// 十进制转化为各进制.cpp : Defines the entry point for the console application. // #include #include using namespace std; int main() { while(1) { int input; cout cin>>input; cout int num2,原创 2014-03-27 18:15:14 · 374 阅读 · 0 评论 -
13test04:捕鱼
#include using namespace std; int main() { int fish_sum,flag=1; for(fish_sum=6;flag;fish_sum++) { int i=1; for(int x=fish_sum;i { { if((x-1)%5==0) x=4*(x-1)/5; else flag=0; } } if(f原创 2014-03-27 18:10:56 · 447 阅读 · 0 评论 -
13test02:阶乘
//假设32位int型变量y是表示最大人数的x的阶乘,即y=x!,当x最大值取什么时,y取最大值 //,且乘法不溢出。 #include using namespace std; unsigned int Fun(unsigned int); int main() { unsigned int max_person_num=0; max_person_num=~max_person原创 2014-03-27 18:08:02 · 468 阅读 · 0 评论 -
杨辉三角
#include using namespace std; int main() { const int m=15; int a[m][m],i,j;//int a[9][9]9行9列的二位数组,a[0][0]~a[8][8],因此下面输出数组内容到a[9][9]会异常,利用VC++编译结果正常显示但 //提示程序未正常运行一般就是指针和数组越界的问题。利用常量做数组下标是个好习惯原创 2014-03-27 18:17:29 · 285 阅读 · 0 评论 -
十进制转各进制
// 十进制转化为各进制.cpp : Defines the entry point for the console application. // #include #include using namespace std; int main() { while(1) { int input; cout cin>>input; int num2,num8,num原创 2014-03-27 18:16:20 · 381 阅读 · 0 评论 -
13test06:花朵数
#include using namespace std; #define N a//定义宏时后面不加;否则会把‘;’一起定义为宏. int getP(int,int);// int getWel(int,int*); int main() { while(1) { int numbers; cout cin>>numbers; int p[7],sum=0;//用于存原创 2014-03-27 18:12:37 · 340 阅读 · 0 评论 -
13test02:信用卡校验
/*#include using namespace std; void input(); int counter=0,jishu_sum=0,oushu_sum=0,sum=0; int input_num[20]; int main() { cout cout input(); cout for(int i=0;i cout int jishu_i=counter;原创 2014-03-27 18:10:14 · 407 阅读 · 0 评论 -
关于char类型的说明
#include using namespace std; int main() { char ch=128;//VC编译器默认是有符号的。但c并未明确给出。由编译器自身确定. int a=ch; cout return 0; } //对于C++中的char类型,在VC编译器中默认为signed char,其在计算机中是数值存储的,范围 //是-128~127.赋值原创 2014-03-27 08:34:53 · 1242 阅读 · 0 评论