自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

吸颖力|Attractive

谋事在人,成事在天

  • 博客(13)
  • 收藏
  • 关注

原创 数字的字符串转换成 对应整数输出

#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

原创 杨辉三角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

原创 求第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

原创 插入排序

#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

原创 选择排序

选择排序: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

原创 鸡尾酒排序(类似冒泡排序)

#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

原创 二进制输出整数

#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

原创 求负数的补码

求负数的补码,可以使用较直接的方法,如下:

2014-04-09 00:26:27 1723 4

原创 单链表的创建、排序、逆置等

#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

原创 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 1916

原创 cin对象支持的3种模式的单字符输入

cin对象支持3 种不同模式的单字符输入 #include using namespace std; int main() {    char ch; int count=0; cout cin>>ch; while(ch!='#') { cout ++count; cin>>ch; } cout      return 0; } 此模式忽略空格,

2014-02-26 11:16:31 985

原创 编写一个产生1000个1到10范围内的随机整数,统计各数字出现的次数

编写一个产生1000个1到10范围内的随机整数,统计各数字出现的次数 #include #include//为rand,srand函数提供原型; #define NUM 1000 int main(void) {    unsigned int seed;    int i,l;    int a[10]={0,0,0,0,0,0,0,0,0,0};    puts(

2014-02-14 21:03:11 9365 2

原创 错误点

#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

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除