Skip to content

Commit

Permalink
init the learn
Browse files Browse the repository at this point in the history
  • Loading branch information
dengshaolin committed Mar 10, 2011
0 parents commit 6cdf4ef
Show file tree
Hide file tree
Showing 1,288 changed files with 194,514 additions and 0 deletions.
Binary file added ARG/consttest
Binary file not shown.
9 changes: 9 additions & 0 deletions ARG/consttest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdio.h>
int main()
{
const int b=10;
const int * const a=&b;
int const * const c=&b;
printf("a:%d\n",*a);
printf("c:%d\n",*c);
}
Binary file added ARG/likePic
Binary file not shown.
16 changes: 16 additions & 0 deletions ARG/likePic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>
int main()
{
int i,j;
printf("\1\1\n");
for(i=1;i<11;i++)
{
for(j=1;j<=i;j++)
{
printf("%c%c",219,219);
printf("\n");
}
}
return 0;
}

7 changes: 7 additions & 0 deletions ARG/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>
#include "test1.c"
int main(){
char * sr="hello,world!";
test1(sr);
return 0;
}
Binary file added ARG/maintest
Binary file not shown.
Binary file added ARG/outsd
Binary file not shown.
17 changes: 17 additions & 0 deletions ARG/outsd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
int main()
{
int i,j,result;
printf("\n");
for(i=1;i<10;i++)
{
for(j=1;j<=i;j++)
{
result=i*j;
printf("%d*%d=%-3d",j,i,result);
}
printf("\n");
}
return 1;
}

Binary file added ARG/shell/myshell_AG
Binary file not shown.
38 changes: 38 additions & 0 deletions ARG/shell/shell.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <iostream>
using namespace std;

void shell_sort(int a[],int len)
{
int h,i,j,temp;

for(h=len/2;h>0;h=h/2)//控制增量
{
for(i=h;i<len;i++)//这个循环 直接插入排序
{
temp=a[i];
for(j=i-h;(j>=0&&temp<a[j]);j-=h)
{
a[j+h]=a[j];
}
a[j+h]=temp;
}
}
}
void print_array(int a[],int len)
{
for(int i=0;i<len;i++)
{
cout<<a[i]<<"";
}
cout<<endl;
}
int main()
{
int a[]={7,3,5,8,9,1,2,4,6};
cout<<"before shell sort";
print_array(a,9);
shell_sort(a,9);
cout<<"after shell sort";
print_array(a,9);
return 0;
}
36 changes: 36 additions & 0 deletions ARG/sushu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
bool mysushu(int m){
int temp=sqrt(m);
for (int i=2;i<=temp;i++)
{
if(! m%temp)
{
return true;
}
else
break;
}
return false;
}

int main()
{
int n=1,m=2;int count=0;
int i=1;
printf("please input a range:a,b\n");
scanf("%d,%d",&m,&n);
for(i=m;i<=n;i++)
{
if (mysushu(i))
{
printf("%d is a sushu\n",i);
count++;
}
else
break;
}
printf("%d-%d have %d suhu",m,n,count);
return 0;
}
10 changes: 10 additions & 0 deletions ARG/test1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdio.h>
void test1(char * s)
{
printf("this is a test %s",s);
}
/*stuct test_struct{
int i;
int j;
char * name;
}test1;*/
18 changes: 18 additions & 0 deletions ARG/testchar.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int test(char *src)
{
char dest[1024]={0};
strcpy(dest,src,strlen(src)-1);
return 1;
}

int main()
{
char * a="hello";
int b=test(a);
printf("%d",b);
pause();
return 0;
}
2 changes: 2 additions & 0 deletions C++/CVS/Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
D/primer////
D/up_c++////
1 change: 1 addition & 0 deletions C++/CVS/Repository
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++
1 change: 1 addition & 0 deletions C++/CVS/Root
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/dengshaolin/repository_cvs/
2 changes: 2 additions & 0 deletions C++/primer/Alog/CVS/Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/quicksort.cpp/1.1.1.1/Tue Jan 11 07:48:14 2011//
D
1 change: 1 addition & 0 deletions C++/primer/Alog/CVS/Repository
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++/primer/Alog
1 change: 1 addition & 0 deletions C++/primer/Alog/CVS/Root
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/dengshaolin/repository_cvs/
43 changes: 43 additions & 0 deletions C++/primer/Alog/quicksort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <iostream>
using namespace std;
void QuickSort(int *pData,int left,int right)
{
int i(left),j(right),middle(0),iTemp(0);
middle=pData[(left+right)/2];//求中间值
middle=pData[(rand()%(right-left+1))+left]; //生成大于等于left小于等于right的随机数
do{
while((pData[i]<middle)&&(i<right))//从左扫描大于中值的数
i++;
while((pData[j]>middle) && (j>left))//从右扫描小于中值的数
j--;
//找到了一对值,交换
if(i<=j){
iTemp=pData[j];
pData[j]=pData[i];
pData[i]=iTemp;
i++;
j--;
}
}while(i<=j);//如果两边扫描的下标交错,就停止(完成一次)
//当左边部分有值(left<j),递归左半边
if(left<j){
QuickSort(pData,left,j);
}
//当右边部分有值(right>i),递归右半边
if(right>i){
QuickSort(pData,i,right);
}
}
int main()
{
int data[]={10,9,8,7,6,5,4};
const int count(6);
QuickSort(data,0,count);
for(int i(0);i!=7;++i)
{
cout<<data[i]<<""<<flush;
}
cout<<endl;
return 0;
}

7 changes: 7 additions & 0 deletions C++/primer/CVS/Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
D/Alog////
D/cp1////
D/cp2////
D/cp3////
D/cp4////
D/inteview////
D/strop////
1 change: 1 addition & 0 deletions C++/primer/CVS/Repository
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++/primer
1 change: 1 addition & 0 deletions C++/primer/CVS/Root
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/dengshaolin/repository_cvs/
3 changes: 3 additions & 0 deletions C++/primer/cp1/CVS/Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
D/ex1////
D/ex2////
D/ex_tmp////
1 change: 1 addition & 0 deletions C++/primer/cp1/CVS/Repository
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++/primer/cp1
1 change: 1 addition & 0 deletions C++/primer/cp1/CVS/Root
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/dengshaolin/repository_cvs/
Empty file added C++/primer/cp1/ex1/AUTHORS
Empty file.
10 changes: 10 additions & 0 deletions C++/primer/cp1/ex1/CVS/Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/AUTHORS/1.1.1.1/Tue Jan 11 07:48:14 2011//
/ChangeLog/1.1.1.1/Tue Jan 11 07:48:14 2011//
/Makefile.am/1.1.1.1/Tue Jan 11 07:48:14 2011//
/NEWS/1.1.1.1/Tue Jan 11 07:48:14 2011//
/README/1.1.1.1/Tue Jan 11 07:48:14 2011//
/autoscan.log/1.1.1.1/Tue Jan 11 07:48:14 2011//
/configure/1.1.1.1/Tue Jan 11 07:48:14 2011//
/configure.in/1.1.1.1/Tue Jan 11 07:48:14 2011//
D/autom4te.cache////
/main.c/1.2/Tue Jan 11 08:40:50 2011//
1 change: 1 addition & 0 deletions C++/primer/cp1/ex1/CVS/Repository
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++/primer/cp1/ex1
1 change: 1 addition & 0 deletions C++/primer/cp1/ex1/CVS/Root
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/dengshaolin/repository_cvs/
Empty file added C++/primer/cp1/ex1/ChangeLog
Empty file.
Empty file added C++/primer/cp1/ex1/Makefile.am
Empty file.
Empty file added C++/primer/cp1/ex1/NEWS
Empty file.
Empty file added C++/primer/cp1/ex1/README
Empty file.
4 changes: 4 additions & 0 deletions C++/primer/cp1/ex1/autom4te.cache/CVS/Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/output.0/1.1.1.1/Tue Jan 11 07:48:14 2011//
/requests/1.1.1.1/Tue Jan 11 07:48:14 2011//
/traces.0/1.1.1.1/Tue Jan 11 07:48:14 2011//
D
1 change: 1 addition & 0 deletions C++/primer/cp1/ex1/autom4te.cache/CVS/Repository
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C++/primer/cp1/ex1/autom4te.cache
1 change: 1 addition & 0 deletions C++/primer/cp1/ex1/autom4te.cache/CVS/Root
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/dengshaolin/repository_cvs/
Loading

0 comments on commit 6cdf4ef

Please sign in to comment.