基础
文章平均质量分 55
chenzaitian
这个作者很懒,什么都没留下…
展开
-
错误点
#include #define ROOW 3 #define LINE 5 void average(double ar[][LINE],int l); double max(double ar[][LINE],int l); int main(void) { double arr[ROOW][LINE]={{1,2,3,4,5.6},{66.23,7,8,9,22.3},{原创 2014-01-21 10:14:02 · 811 阅读 · 0 评论 -
二进制输出整数
#include void binary_out(int x); using namespace std; int main() { cout<<"please enter the number: "; int n; cin>>n; cout<<" the binary of "<<n<<" is "; binary_out(n); cout<<endl; re原创 2014-04-09 15:31:28 · 556 阅读 · 0 评论 -
数字的字符串转换成 对应整数输出
#include int Str_To_Int(const char*p); using namespace std; int main() { char*ptr="-987321"; int l=Str_To_Int(ptr); cout<<l<<endl; return 0; } //数字的字符串转换成 对应整数输出,例如:“78965” 转换原创 2014-04-19 00:02:13 · 2377 阅读 · 0 评论 -
求第n个斐波那契数
递归法求第n个斐波那契数 #include using namespace std; int Fib_num(int n,int p,int q); int main() { int n; cin>>n; while(n) { int m=Fib_num(n,1,1); cout cin>>n; } return 0; } int Fib_num原创 2014-04-17 00:30:29 · 982 阅读 · 0 评论 -
杨辉三角c++实现
c++实现杨辉三角: #include #include using namespace std; int main() { int n; cin>>n; int i=1; queue pre; queue out; while(i { if(n==1) { cout break; } if(i==1) { cout ++i; con原创 2014-04-17 17:43:32 · 1235 阅读 · 0 评论 -
插入排序
#include using namespace std; void InsertSort(int *a,int m){ for(int i=1;i { int temp=a[i]; int p=i-1; for(;p>=0;--p) if(a[p]>temp) a[p+1]=a[p]; else break; a[p+1]=temp; } } int原创 2014-04-15 16:26:37 · 466 阅读 · 0 评论 -
选择排序
选择排序:xianqu #include using namespace std; void SelectSort(int *a,int m){ for(int i=0;i { int p=i; int temp=a[i]; for(int j=i+1;j { if(a[j] { temp=a[j]; p=j; } } a[p]=a[i]; a[i]=te原创 2014-04-15 14:56:14 · 634 阅读 · 0 评论 -
鸡尾酒排序(类似冒泡排序)
#include using namespace std; int main() { int a[]={53,78,90,21,51,789,852,567,765,8908,253212,32,908}; int m=sizeof(a)/sizeof(*a); int n=m-1; for(int i=0;i<n;) { for(int j=n;j>i;原创 2014-04-14 02:25:24 · 918 阅读 · 0 评论 -
using声明 和 using编译指令 比较
0. using声明使特定的标识符可用,suing编译指令使整个名称空间的名称可用; 1. using声明,由被限定的名称和它前面的关键字”suing“组成,如:using Jill::fetch; using编译指令,由名称空间名和它前面的关键字“using namespace”组成,如:using namespace Jill; 2. 如果函数中定义了一个变量(f原创 2014-03-05 14:36:25 · 1915 阅读 · 0 评论 -
单链表的创建、排序、逆置等
#include #include using namespace std; //定义链表节点; typedef struct Node{ int data; Node*next; }node; //创建链表; node*Create_list() { node *head; node*p; node*s; int x; head=(node*)m原创 2014-04-08 01:36:41 · 850 阅读 · 0 评论