自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(46)
  • 收藏
  • 关注

原创 深入探究connect函数

本函数用于创建与指定外部端口的连接。s参数指定一个未连接的数据报或流类套接口。如套接口未被捆绑,则系统赋给本地关联一个唯一的值,且设置套接口为已捆绑。请注意若名字结构中的地址域为全零的话,则connect()将返回WSAEADDRNOTAVAIL错误。  对于流类套接口(SOCK_STREAM类型),利用名字来与一个远程主机建立连接,一旦套接口调用成功返回,它就能收发数据了。对于数据报类套接口

2017-06-10 11:07:29 363

转载 Java swing简介

#include #define MAX 20typedef struct{int row;int col;int val;}TriNode;typedef struct{    TriNode data[MAX+1];    int m,n,t;}TriTable;main(){    int i,j,cnt=1;    int c

2017-03-13 16:24:12 2017

转载 QWidget简介

#include#include#define MaxSize 20#define ElemType inttypedef struct SqStack{    ElemType elem[MaxSize];    int top;}SqStack;void Init_SqStack(SqStack *s){    s->top=-1;}

2017-03-13 16:21:49 2351

转载 QString简介

#include#include#include#define MaxSize 20typedef int ElemType;typedef struct SeqList{  ElemType elem[MaxSize];  int length;}SeqList;int Init_SeqList(SeqList &L){  L.length=0

2017-03-13 16:18:55 655

转载 java时间总结

时区整个地球分为二十四时区,每个时区都有自己的本地时间。为了统一起见,使用一个统一的时间,称为通用协调时(UTC, Universal Time Coordinated,也翻译为:全球标准时间)。UTC与格林尼治平均时(GMT, Greenwich Mean Time,也翻译成:格林威治标准时间)一样,都与英国伦敦的本地时相同。UTC 与 GMT 基本相同。UTC(世界标准时间)协调世界时,又称世...

2018-06-22 08:32:55 276

转载 利用Service实现简单的音乐播放功能

1、本例利用Service实现简单的音乐播放功能,下面是效果图。(点击开始播放开启服务,音乐播放,点击“停止播放”关闭服务,音乐停止播放。)2、核心代码:MusicService.java:package thonlon.example.cn.servicedemo;import android.app.Service;import android.content.Intent;import an...

2018-06-22 08:31:52 3590

转载 Android图片处理

在开发中我们会遇到一些图片处理问题,比如说缓存图片了、限制图片大小了、查看图片了等。上一篇文章介绍了图片的全景效果查看,今天介绍一个图片缩放,我们如果有时间的话,可以自己写一个属于自己的库,里面会用到view的按压、事件分发、手势等一些知识,如果没有时间或者不会其他的方法,不妨来看看这个PhotoView。这是一个图片缩放库,对于这样的还有GitView等,下面我就介绍一些用法。功能:正常加载图片...

2018-06-22 08:30:37 205

转载 安卓组件化开发

Android项目中代码量达到一定程度,编译将是一件非常痛苦的事情,短则一两分钟,长则达到五六分钟。Android studio推出instant run由于各种缺陷一般情况下是被关闭的。组件化开发可以有效降低代码模块的耦合度,使代码架构更加清晰,同时模块化的编译可以有效减少编译时间,当然总的编译时间是不会减少的,只是App模块化之后开发某个模块时,只需要编译特定模块,可以快速编译调试。原理组件化...

2018-06-22 08:24:19 867 1

原创 100

#include using namespace std;// 辅助函数:交换x和y的值template void swapData (T &x, T &y){ T temp;  temp = x; x = y; y = temp;}// 用起泡法对数组A的n个元素进行排序template void BubbleSort(T a[], int

2017-06-10 10:46:38 262

原创 99

#include using namespace std;// 辅助函数:交换x和y的值template void swapData (T &x, T &y){ T temp;  temp = x; x = y; y = temp;}// 用起泡法对数组A的n个元素进行排序template void BubbleSort(T a[], int

2017-06-10 10:46:05 296

原创 98

#include using namespace std;// 辅助函数:交换x和y的值template void swapData(T &x, T &y){ T temp;  temp = x; x = y; y = temp;}// 用选择法对数组A的n个元素进行排序template void selectSort(T a[], int

2017-06-10 10:45:32 247

原创 97

#include using namespace std;template void insertSort(T A[], int n){ int i, j; T   temp;  // 将下标为1~n-1的元素逐个插入到已排序序列中适当的位置 for (i = 1; i  {  //从A[i-1]开始向A[0]方向扫描各元素,寻找适当位置插入A[i]

2017-06-10 10:44:53 332

原创 96

#include #include "link.h"  //参见"实验9"部分using namespace std;template class Link : public LinkedList{public: void insertOrder(const T& item);};template void Link::insertOrder(const

2017-06-10 10:44:15 285

原创 95

#include #include #include "array.h"using namespace std;int main(){ int n; double average,total = 0; cout  cin >> n; Array  score(n); for (int i=0; i {  cout   cin >> sco

2017-06-10 10:43:34 1483

原创 92、93、94

#include #include #include #include #include using namespace std;using namespace boost::lambda;int main() { int intArr[] = { 30, 90, 10, 40, 70, 50, 20, 80 }; const int N = sizeof(in

2017-06-10 10:41:53 310

原创 89、90、91

#include #include #include using namespace std;int main() { string str; map ismap; int i = 0; while (1) {  cout   cin >> str;  if (str == "QUIT")   break;  int counter = isma

2017-06-10 10:40:15 328

原创 86、87、88

#include #include #include using namespace std;int main(){ int a[] = {5, 1, 4, 6}; cout  stack iStack; for (int i = 0; i   iStack.push(a[i]); if (!iStack.empty()) {  cout  

2017-06-10 10:39:03 364

原创 83、84、85

#include #include using namespace std;typedef vector INTVECTOR;int main(){ INTVECTOR s; for (int i = 0; i   s.push_back(i);  cout  } return 0;}#include #include #includ

2017-06-10 10:36:47 496

原创 80、81、82

#include using namespace std;#define D(a) T ofstream T("output.out");int main() { D(int i = 53;) D(float f = 4700113.141593;) char* s = "Is there any more?"; D(T.setf(ios::unitbuf);)

2017-06-10 10:35:40 673

原创 77、78、79

#include #include #include using namespace std;int main(int argc, char* argv[]){  strstream textfile; {  ifstream in(argv[1]);        textfile  } ofstream out(argv[2]);   c

2017-06-10 10:34:14 428

原创 74、75、76

#include #include using namespace std;class Dog {public: Dog(int weight, long days) :  itsWeight(weight), itsNumberDaysAlive(days) { } ~Dog() { } int getWeight() const {  return

2017-06-10 10:32:32 463

原创 71、72、73

#include #include #include #include #include using namespace std;class SomeClass{public: SomeClass(string name):str(name){cout  ~SomeClass(){cout SomeClass(SomeClass &){cout So

2017-06-10 10:30:05 253

原创 68、69、70

#include using namespace std;class Exception{public: Exception(){}    virtual ~Exception(){}    virtual void PrintError() = 0;};class OutOfMemory : public Exception{public:   

2017-06-10 10:28:40 580

原创 65、66、67

#includeint fun(int n,int m){  if (n    return 1;  if(m==1||n==m)    return 1;  else    return fun(n-1,m-1)+m*fun(n-1,m);}int main(){    int n,m;    int sum=0;    scanf("%d

2017-06-10 10:22:13 384

原创 62、63、64

#includeint fun(int n,int m){  if (n    return 1;  if(m==1||n==m)    return 1;  else    return fun(n-1,m-1)+m*fun(n-1,m);}int main(){    int n,m;    int sum=0;    scanf("%d

2017-06-10 10:20:45 252

原创 59、60、61

#include#includeint main(){    int m,n,sum;    scanf("%d %d",&n,&m);    if(m>n)        return 0;    if(m>n/2)        m=n-m;    if(m==1||m==0||m==n)    {        printf("1");  

2017-06-10 10:18:23 288

原创 56、57、58

?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950

2017-06-10 10:08:55 369

原创 53、54、55

题目:宏#define命令练习(3)   1.程序分析:2.程序源代码:#define LAG >#define SMA #define EQ ==#include "stdio.h"#include "conio.h"void main(){  int i=10;  int j=20;  if(i LAG j)    printf("\40:

2017-06-09 15:34:27 232

原创 50、51、52

题目:学习使用register定义变量的方法。1.程序分析:2.程序源代码:#include "stdio.h"#include "conio.h"void main(){  register int i;  int tmp=0;  for(i=1;i  tmp+=i;  printf("The sum is %d\n",tmp);  getch()

2017-06-09 15:32:02 269

原创 47、48、49

题目:学习使用auto定义变量的用法1.程序分析:      2.程序源代码:#include "stdio.h"#include "conio.h"main(){  int i,num;  num=2;  for(i=0;i  {    printf("\40: The num equal %d \n",num);    num++;    {

2017-06-09 15:30:36 222

原创 44、45、46

题目:有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。1. 程序分析:首先判断此数是否大于最后一个数,然后再考虑插入中间的数的情况,插入后     此元素之后的数,依次后移一个位置。2.程序源代码:#include "stdio.h"#include "conio.h"main(){  int a[11]={1,4,6,9,13,16,19,2

2017-06-09 15:29:13 331

原创 41、42、43

题目:求100之内的素数   1.程序分析:2.程序源代码:#include "stdio.h"#include "math.h"#define N 101main(){  int i,j,line,a[N];  for(i=2;i    for(i=2;i      for(j=i+1;j      {        if(a!=0&&a[j]

2017-06-09 15:27:45 223

原创 38、39、40

题目:学习gotoxy()与clrscr()函数   1.程序分析:2.程序源代码:#include "conio.h"#include "stdio.h"void main(void){  clrscr();/*清屏函数*/  textbackground(2);  gotoxy(1, 5);/*定位函数*/  cprintf("Output at r

2017-06-09 15:26:24 183

原创 35、36、37

题目:一个5位数,判断它是不是回文数。即12321是回文数,个位与万位相同,十位与千位相同。   1.程序分析:同29例2.程序源代码:#include "stdio.h"#include "conio.h"main( ){  long ge,shi,qian,wan,x;  scanf("%ld",&x);  wan=x/10000;  qian=

2017-06-09 15:24:24 266

原创 32、33、34

题目:利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。1.程序分析:2.程序源代码:#include "stdio.h"#include "conio.h"main(){  int i=5;  void palin(int n);  printf("\40:");  palin(i);  printf("\n");  getch

2017-06-09 15:22:47 297

原创 29、30、31

题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。1.程序分析:请抓住分子与分母的变化规律。2.程序源代码:#include "stdio.h"#include "conio.h"main(){  int n,t,number=20;  float a=2,b=1,s=0;  for(n=1;n

2017-06-09 15:21:33 306

原创 26、27、28

题目:猴子吃桃问题:猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个   第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下   的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。1.程序分析:采取逆向思维的方法,从后往前推断。2.程序源代码:#include "stdio.h"#include "c

2017-06-09 15:20:25 326

原创 23、24、25

题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时   共有5个数相加),几个数相加有键盘控制。1.程序分析:关键是计算出每一项的值。2.程序源代码:#include "stdio.h"#include "conio.h"main(){  int a,n,count=1;  lon

2017-06-09 15:18:53 234

原创 20、21、22

题目:利用条件运算符的嵌套来完成此题:学习成绩>=90分的同学用A表示,60-89分之间的用B表示,   60分以下的用C表示。1.程序分析:(a>b)?a:b这是条件运算符的基本例子。2.程序源代码:#include "stdio.h"#include "conio.h"main(){  int score;  char grade;  print

2017-06-09 15:17:42 283

原创 17、18、19

题目:判断101-200之间有多少个素数,并输出所有素数。1.程序分析:判断素数的方法:用一个数分别去除2到sqrt(这个数),如果能被整除,      则表明此数不是素数,反之是素数。       2.程序源代码:#include "stdio.h"#include "conio.h"#include "math.h"main(){  int m,i,

2017-06-09 15:16:25 246

空空如也

空空如也

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

TA关注的人

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