自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 资源 (1)
  • 收藏
  • 关注

原创 排序与检索6174问题

int get_next(int x){ int a,b,n; char s[10]; sprintf(s,"%d",x);//化为字符串 n=strlen(s); for(int i=0;i<n;i++)//冒泡排序 { for(int j=i+1;j<n;j++) { if(s[i]>s[j]) { char t=s[i]; s[i]=s[j]

2014-11-30 21:58:12 326

原创 冒泡排序

在要排序的一组数中,对当前还未排好序的范围内的全部数,自上而下对相邻的两个数依次进行比较和调整,让较大的数往下沉,较小的往上冒。即:每当两相邻的数比较后发现它们的排序与排序要求相反时,就将它们互换。稳定O(n2)for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(s[i]>s[j]){ char t=s[i]; s[i]=s[

2014-11-30 21:39:36 249

原创 bign的结合有问题无法运行

#include iostream#include #include using namespace std;const int maxn=200;struct bign{ bign(){ int len,s[maxn]; memset(s,0,sizeof(s)); len=1; }bign(int num){ *this=num;}bign(char *nu

2014-11-30 21:14:57 353

原创 bool

1、类型不同bool为布尔型用作逻辑判断BOOL在typedef int BOOL;在typedef long BOOL;2、长度不同bool只有一个字节BOOL长度视实际环境来定,一般可认为是4个字节3、取值不同bool取值false和true,是0和1的区别; false可以代表0,但true有很多种,并非只有1。

2014-11-30 19:21:41 667

原创 重载bign常用运算符

111

2014-11-30 19:04:08 480

原创 设计一个结构体bign来存贮高精度非负整数

const int maxn=3000;struct bign{ int len,s[maxn]; bign(){memset(s,0,sizeof(s));len=1;}};上面的结构体中有一个函数,称为构造函数,它是c++中特有的,作用是进行初始化。事实上,当定义bign X时候,就会执行这个函数,把x.s清零,并赋值x.len=1;需要注意的是在c++中,并不需要typed

2014-11-30 15:18:25 827

原创 阶乘的精确值

#include #include const int maxn=3000;int f[maxn];int main(void){ int i,j,n; scanf("%d",&n); memset(f,0,sizeof(f)); f[0]=1; for(i=2;i<=n;i++){//注意是i是从2开始的 int c=0; for(j=0;j<=maxn-1;j++){

2014-11-30 15:00:55 429

原创 高精度运算之小学生算法

#include int main(void){ int a,b; while(scanf("%d %d",&a,&b)==2){ if(!a&&!b){//此时的a和b都不为0 break; } int c=0,ans=0; for(int i=9;i>=0;i--){ c=(a%10+b%10+c)>9?1:0; ans+=c; a/=10;

2014-11-30 14:28:06 321

原创 周期串

注意:1临时定义变量,比如i和j定义再循环体内,因此在循环体后就无法访问它们在使用前才定义变量能让程序更加清晰。但是这个语法不是ANSIC的所以程序的扩展名保存成.cpp#include #include int main(){ char word[100]; scanf("%s",word); int len=strlen(word); for(int i=1;i<=len;i++

2014-11-29 17:27:15 323

原创 TeX括号

#include int main(){ int c,q=1; while((c=getchar())!=EOF) { if(c=='"') { printf("%s",q?"``":"''"); q=!q; }else{ printf("%c",c); } } return 0;}

2014-11-29 17:20:02 324

原创 WERTYU

#include char *s="`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./";int main(){ int i,c; while((c=getchar())!=EOF) { for(i=1;s[i]&&s[i]!=c;i++){ if(s[i]){ putchar (s[i-1]); }else{

2014-11-29 16:59:53 326

原创 位段的声明

有些信息只需要占一个或者几个二进制位,不需要占用一个完整的字节,为节省空间,所以产生了位段结构。位段就是把一个字节中的二进制划分为几个不同的区间,并说明每个区段的位数每个段有一个段名,允许在程序中按段名进行操作,这样就可以把几个不同的对象用一个字节的二进制位段来表示。位段的声明和位段变量的声明相仿:Struct 位段结构名{位段表};位段表的形式如下:类型说

2014-11-26 15:21:49 485

原创 编程实现以二进制形式系那是无符号整数

%u 表示无符号按位与运算符

2014-11-24 13:29:27 783

原创 位运算综合举例1

~0的结果是将所有二进制

2014-11-24 00:50:00 388

原创 strcpy函数的实现

头文件:#include 函数原型:

2014-11-18 19:29:00 312

原创 strcmp函数的实现

头文件:#include 函数原型:int

2014-11-18 19:26:19 474

原创 stract函数的实现 连接str2到str1的后面

#include #include #include #define MAXN 50char *ownStrcat(char *str1,const char *str2);int main(void){ char array1[MAXN],array2[MAXN]; scanf("%s %s",array1,array2); ownStrcat(array1,array2);注

2014-11-18 19:22:35 2387

原创 位运算符的介绍

前面的各种运算都是以字节为最基本存贮单元进行操作的。但在很多系统

2014-11-18 02:26:52 362

原创 类型定义typedef

除了可以直接使用c语言提供的

2014-11-18 02:01:59 518

原创 用枚举类型输出得到的3种不同色的球的可能取法的排列情况

在口袋中装有红,黄,蓝和白4种颜色的小球若干个,每次从口袋中先后去除

2014-11-18 01:38:52 1703

原创 枚举变量的定义

枚举变量有不同的方法定义,设有变量

2014-11-18 01:33:36 6422

原创 枚举类型的使用

枚举类型在使用中有

2014-11-18 01:30:45 567

原创 枚举类型的声明

枚举是一种数据类型,而不是一种构造类型,应为它

2014-11-18 00:34:44 2526

原创 定义结构记录学生分数,并由高到低排列出来

Define a struct type that contains a student’s number, name and score of three courses. Write a program, to enter 5 students’ information(name, number & scores of the 3 courses), and calculate the tot

2014-11-17 23:10:35 523

原创 联合变量的赋值和使用

#include #include #define N 3 int main(void){ struct { char name[10]; int age; char identity; union { int clas; char office[10]; }classOrOffice; }person[N]; int i; for(i=0;i

2014-11-17 22:04:54 1187

原创 联合变量的定义

联合变量的定义有3种方法:1先声明联合类型,

2014-11-17 20:55:49 2128

原创 联合变量的赋值和使用

对联合变量的赋值,只能是对变量的成员进行赋值,联合变量的成员表如下:

2014-11-17 20:41:56 1448

原创 联合类型的声明

声明一个联合类型的一般形式如下:union联合类型

2014-11-17 20:31:07 473

原创 联合的概念

与构造类型一样,联合类型也是

2014-11-17 13:17:16 734

原创 指向结构类型数组元素的指针

可用指针来指向结构类型数组元素,设pStudent为指向

2014-11-17 13:09:48 448

原创 结构类型指针变量的使用实例

#include #include #include int main(void){ struct DateType { int year; int month; int day; }; struct StudentType { int num; char *name; char sex[3]; struct DateType birthday;

2014-11-17 02:27:38 475

原创 指向结构类型变量的指针

1指向结构类型变量的指针

2014-11-17 01:10:39 2361

原创 建立同学通讯录

#include #include #define NUM 3int main(void){ struct MemberType { char name[20]; char phone[10]; }; struct MemberType menber[NUM]; int i; for(i=0;i<NUM;i++) { printf("\n输入第%d个人通讯信息:\

2014-11-17 01:06:47 1541

原创 结构类型数组实例(计算学生的平均人数以及及格人数)

#include #include #define N 6int main(void){ int i,countOfPass=0; float av,sum=0.0; struct StudentType { int num; char *name; char sex[3]; int age; float score; }; struct StudentTy

2014-11-17 00:42:26 821

原创 结构类型数组

数组元素也可以使结构类型,可以

2014-11-16 20:36:33 803

原创 结构类型变量的初始化

结构类型变量也与其他

2014-11-16 20:19:37 460

原创 结构类型变量的引用

表示结构变量成员的一般形式如下

2014-11-16 19:49:34 779

原创 结构的声明

struct结构类型名{}

2014-11-16 19:44:07 614

原创 结构的概述

在解决实际问题中,一组数据一般具有不同的数据类型,

2014-11-16 18:58:28 386

原创 getchar函数的结束读取的方法

直接输入文件结束符是windows是cril+z

2014-11-16 02:35:26 1286

visual c++6.0

这是一个大家都适合的软件每个人都可以用的哦适合于win7系统,win8不合适哦

2014-09-16

空空如也

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

TA关注的人

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