自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 无法加载模块

改正方法:

2014-07-18 21:01:52 6838 1

转载 Android程序出现错误“Field requires API level 5 (current min is 4)”的解决

有时候,你建立Android Project的时候,选择较低的 min API Level,在程序中复写(@Override)某个基类的方法时,会出现错误提示,诸如:Field requires API level 5 (current min is 4)。意思是这个复写方法不支持你的min API Level 4,只支持min API Level 5及以上,你可以通过调高min API Le

2013-05-22 22:33:54 3803 1

原创 使用GregorianCalendar输出日历

//使用GregorianCalendar输出日历package Test;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import java.util.Scanner;public class Test { public static void main(St

2013-03-26 20:37:47 2058

原创 选择排序

//选择排序package com.SelectSort;public class SelectSort { public static void main(String[] args) { int[] array = new int[]{15,27,34,12,15,22,48,1}; outPut(array); selectAscending(array);

2013-03-20 22:17:55 688

原创 插入排序法

//插入排序package com.InsertSort;public class InsertSort { public static void main(String[] args) { int[] array = new int[]{3,69,42,18,1,25}; outPut(array); //输出数组 insertAscending(array);

2013-03-20 21:42:05 2595

原创 冒泡排序法

//冒泡排序法package com.test;public class Sort { public static void main(String[] args) { int[] array = new int[]{2,4,2,5,3,67,4}; outPut(array); bubbingAscending(array); bubbingDscending(arra

2013-03-19 21:25:54 718

原创 2. 计算出1900年1月1日至当前日期之间总共间隔多少天,将其除以7取余数,该结果即为当月第一天是星期几,按日历格式输出

//输入一个日期,2010-10 输出该月的月历://**********************************// 10月//**********************************//日 一 二 三 四 五 六// 1 2//3 4 5 6 7 8 9//10 11 12 13 14 15 16//17 18 19 20 21 22 23 /

2013-03-19 11:18:31 12855 1

原创 有一个字符串s,t,d,g,h,m怎么把他转换成数组然后排序!(split的使用)

//有一个字符串s,t,d,g,h,m怎么把他转换成数组然后排序!//2013年3月12日public class Sort { private static String str = "a,t,b,c,a,e,f"; public static void main(String[] args) { String str2[] = str.split(","); //以','作为字

2013-03-13 16:16:14 2190

原创 某公司的雇员分为以下若干类

/*2012年12月28日 某公司的雇员分为以下若干类:Employee:这是所有员工总的父类, 属性:员工的姓名,员工的生日月份。 方法:getSalary(int month) 根据参数月份来确定工资, 如果该月员工过生日,则公司会额外奖励100元。SalariedEmployee:Employee

2012-12-28 01:17:41 17489

原创 实现在一个数组指定位置添加元素和删除元素的功能

/*实现在一个数组指定位置添加元素和删除元素的功能。 *1、数组容量问题? *2、添加元素前后数组中元素的变化 *3、删除元素前后数组中元素的变化 *2012年12月26日 */import java.util.Scanner;public class Array { public Array() { } public void Init() { System.

2012-12-26 23:25:12 9743

原创 有n个整数,使其前面各数顺序后移m个位置,最后m个变为前面的m个

/*有n个整数,使其前面各数顺序后移m个位置,最后m个变为前面的m个* 2012年12月25日(今天圣诞节,极其无聊)*/import java.util.Scanner;public class BackNum { public BackNum(int n, int m) { this.n = n; this.m = m; } //初始化数组 public voi

2012-12-25 21:37:35 2778

原创 求 a+aa+aaa+…….+aaaaaaaaa=? 其中a为1至9之中的一个数,项数也要可以指定。

//2012年12月24日import java.util.Scanner;public class An { /** * @param args */ public An(int a, int n) { this.a = a; this.n = n; } public void Calculate() { int i; int s = 0;

2012-12-24 19:36:11 3733

转载 ctrl+z

源代码为:#include #include using namespace std;int main(){string world;while (cin >> world)cout return 0;}此程序有个问题,在windows操作系统下用ctrl+z结束输入后程序处于等待状态,需要再次按下回车才可以正常结束。如:输入abcd^Z不结

2012-03-06 17:59:48 3316 2

转载 #ifndef……#define……#endif

//a.h#ifndef _A_H#define _A_Hclass A{pbulic:A(){}~A(){}}#endif// B.h#ifndef _B_H#define _B_H#include "a.h"class B : public A{public:B(){}~B(){}}#endif

2011-11-26 15:31:58 562

原创 将十六进制的字符串转换为十进制

/* 将16进制的数按字符串形式输入,* * 然后按十进制形式输出。 */#include #include #include #define LEN 10int SixteenToTen(char *sixteenStr); // 用于将十六进制数的字符串转换为十进制数int main(){ char sixteenStr[10

2011-11-15 20:07:39 876

原创 KMP算法

#include #include void Next(char *str,int *next);int FindStr(char *bigStr,char *smallStr, int *next);void main(){ char bigStr[30],smallStr[8]; int next[4]; //next的长度应该为smallStr的一半

2011-10-24 22:19:14 378

原创 第16章习题2

#include #include char BREED[6][10] = { "YORKIE", "CAIRN", "DANDIE", "SHETLAND", "DOBERMAN", "LAB" };class Mammal{public: // constructors Mammal(): age(2), weight(5) {} ~Mammal(){}

2011-10-20 22:19:55 474

原创 约瑟夫环

#include #include typedef struct YueSeFuHuan{ int num; struct YueSeFuHuan *next; struct YueSeFuHuan *before;}YueSeFu;Yue

2011-10-13 23:23:59 858

原创 将一个字符串插入到另一个字符串的某个位置

#include #include #include int StrInsert( char *str, int n, char *str_ins );void DestroyStr( char *str, char *str_ins);void ma

2011-09-20 23:00:40 11172

原创 算法4.3 取一个字符串的子串

#include #include #include int SubString( char *sub, char *str, int n, int len );void main(){ char sub[10],str[20],n,len,i;

2011-09-20 22:10:08 836

原创 算法4.1 在一个字符串寻找子串,并返回位置

#include #include #include #define LEN 20int LocatStr( char *, char *,int );void main(){ int n,a; char *str1,*str2;

2011-09-20 19:39:57 1049

原创 选择排序排列字符串

#include #include void main(){ char *name[]={"peal","apple","pienapl","strawbelly","bannana"}; int k,i,j; char *temp;

2011-07-03 16:30:12 882

原创 插入排序法

#include void main(){ int i,j,a[10],temp; for ( i=0; i<10; i++ ) scanf("%d",&a[i]); for ( i=1; i<10; i++ ) { temp = a[i]; for ( j=i-1; j>=0; j-- ) { if( temp < a[j] )

2011-07-02 19:27:18 344

原创 一些重要的网址

关于内存对齐——http://baike.baidu.com/view/4786260.htm  

2011-06-20 20:53:00 392

转载 关于.H和.C的文章

<br />关于.H和.C的文章<br /><br />In general, header files contain declarations and definitions pertaining to functions defined elsewhere. In general, for any external function you call, there will be a header file which contains the prototype declaration for th

2011-05-16 19:30:00 437

原创 把两个字符串分别写入两个不同的文件,在把它们排序后写入另一个文件

<br />#include <stdio.h>#include <stdlib.h>void main(){ FILE *out1,*out2,*in; char c,str[50],temp; int i=0,j; if ( (out1=fopen("2.c","wb")) == NULL ) { perror("2.c"); exit( EXIT_FAILURE ); }

2011-05-14 21:51:00 990

转载 关于流和缓冲区的理解以及一般标准输入问题的解决方法小结

<br />先看两个问题(以下程序运行环境为WIN2000+DEV-C++4.9.9.2):<br />1、执行以下程序:<br /><br />CODE:[Copy to clipboard]/*****************************************************<br />  Name:            copy_bar.c<br />  Copyright:      kernelxu<br />  Author:           kernelxu<br

2011-05-11 15:06:00 1109

转载 fflush(stdin)

<br />1.       为什么 fflush(stdin) 是错的<br /> <br />首先请看以下程序:<br /> <br />                   #include <stdio.h><br /> <br />int main( void )<br />{<br />    int i;<br />    for (;;) {<br />        fputs("Please input an integer: ", stdout);<br />        scanf

2011-05-11 15:04:00 1270

转载 C语言文件操作基本常识

<br />由于程序中经常有大量对文件的输入输出操作,它经常构成了程序的主要部分,因而C语言提供了很多输入输出的函数,它们分别用于两种类型文件输入输出系统:即由ANSI标准定义的缓冲文件(也称标准文件(流)输入输出(I/O)系统);另一类是ANSI标准中没有定义的非缓冲文件(也称非标准文件(流)输入输出(I/O)系统)。<br />我们已经熟悉了通过键盘和显示器进行输入输出的一些函数,如scanf(),printf()等等,这些通过控制台(键盘、显示器等)进行I/O的操作,可以看作标准文件输入输出系统的一些

2011-05-11 14:45:00 685

原创 微软2 写一个函数,检查字符是否是整数,如果是,返回其整数值。

<br />#include <stdio.h>#include <stdlib.h>#include <string.h>int cheat( int p );void main(){ int c; while ( ( c=getchar())!=EOF ) { getchar(); /*用于吃掉空格或回车*/ c = cheat( c ); if ( isalpha( c ) ) printf("no/n"); else

2011-05-10 22:04:00 1520

原创 微软1 有一个整数数组,请求出两两之差绝对值最小的值

<br />#include <stdio.h>#include <math.h>#include <stdlib.h>void main(){ int *p; int min,ca,n,i,j; scanf("%d",&n); p = ( int * )malloc( n*sizeof( int ) ); if ( p == NULL ) { printf("分配内存失败/n"); exit( EXIT_FAILURE ); }

2011-05-10 21:03:00 1811 1

原创 11.3输入一个字符串,自动分配内存,复制

<br />#include <stdio.h>#include <stdlib.h>#include <string.h>char *str_str( char *str ); int main(){ char str[30],*dst; gets( str ); dst = str_str( str ); printf("%s/n",dst); return EXIT_SUCCESS;}char *str_str( char *st

2011-05-04 18:29:00 1021

原创 输入一个单向链表,输出该链表中倒数第k个结点,链表的倒数第0个结点为链表的尾指针

<br />#include <stdio.h>#include <stdlib.h>typedef struct ListNode{ int m_nKey; struct ListNode *m_pNext;} LIST;void print( LIST *head, int n, int k );int main(){ LIST *head,*p1,*p2; int k,n=0; p1 = p2 = ( LIST * )malloc(

2011-05-04 16:47:00 2004

原创 将两个数组组合成有序数组

<br />#include <stdio.h>void main(){ int a[100],b[100]; int i,j,k,temp,n,m; printf("输入a数组的个数n:"); scanf("%d",&n); printf("输入b数组的个数m:"); scanf("%d",&m); printf("array a:/n"); for( i=0; i<n; i++) scanf("%d",&a[i]); printf("

2011-04-28 12:49:00 839

原创 查找字符串中一个子串的个数

<br />#include <stdio.h>#include <string.h>int find_str( char *str, char *des );void main(){ char str[40],des[10]; int n; gets( str ); gets( des ); n = find_str( str, des ); printf("%d/n",n);}int find_str( char *str, cha

2011-04-27 16:52:00 1394

原创 将小写前移

<br />#include <stdio.h>#include <string.h>void proc( char *str );void main(){ char str[30]; gets( str ); proc( str ); printf("/n%s/n",str);}void proc( char *str ){ char *p,temp; for ( p=str; *str!='/0'; str++ )

2011-04-27 15:18:00 647

原创 找出两个字符串中最大公共子字符串,如"abccade","dgcadde"的最大子串为"cad"

<br />#include <stdio.h>#include <string.h>void same_str( char *str1, char const *str2, char const *str3 );void main(){ char str1[10],str2[30],str3[30]; gets( str2 ); gets( str3 ); same_str( str1, str2, str3 ); printf("/n%s/n",

2011-04-27 14:23:00 6654 1

原创 字符串原地压缩

<br />#include <stdio.h>void yasuo( char *str );void main(){ char str[40]; gets( str ); yasuo( str ); printf("%s/n",str);}void yasuo( char *str ){ int i,j=0,len=1; /*j用来将数组重新复制,len用来记载连续的个数*/ for ( i=0; *(str+i)!='/0'

2011-04-26 19:40:00 1475

原创 对称子字符串的最大长度

<br />#include <stdio.h>int max_len( char *str );void main(){ char str[30]; int len; gets( str ); len = max_len( str ); printf("最长的对称子串的长度%d/n",len);}int max_len( char *str ){ int len,i,j,k,max=0; for ( i=0; *(str+i)

2011-04-25 22:09:00 671

原创 将字符串后面的数字存入另一个数字字符串中

<br />#include <stdio.h>int char_int( char *str, int *a );int main(){ int a[10]; char str[30]; int i,len; gets( str ); len = char_int( str, a ); for ( i=0; i<len; i++) printf("%d ",*(a+i)); printf("/n");}int char

2011-04-24 15:58:00 1139

空空如也

空空如也

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

TA关注的人

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