Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - c 15.4
Search - c 15.4 - List

/*
实现效果:
1 2 6 7 15
3 5 8 14 16
4 9 13 17 22
10 12 18 21 23
11 19 20 24 25
*/
#include <stdio.h>
#define N 5 //阶数,即N*N的螺旋矩阵

void main()
{
    int i, j, num=1, a[N][N];
    for(i=0; i<=N/2; i++)
    {
        for(j=i; j<N-i; j++) a[i][j]=n++;
        for(j=i+1; j<N-i; j++) a[j][N-i-1]=n++;
        for(j=N-i-2; j>i; j--) a[N-i-1][j]=n++;
        for(j=N-i-1; j>i; j--) a[j][i]=n++;
    }
    for(i=0; i<N; i++)
    {
        for(j=0; j<N; j++)
            printf("%2d ",a[i][j]);
        printf("\n");
    }
}
    

 

不知道叫什么,先叫它“回宫图”吧
年初的时候在贴吧瞎逛,看到了一个程序挺有意思,会输出如下的形状:
01 24 23 22 21 20 19
02 25 40 39 38 37 18
03 26 41 48 47 36 17
04 27 42 49 46 35 16
05 28 43 44 45 34 15
06 29 30 31 32 33 14
07 08 09 10 11 12 13
仔细看这个形状,数字是按顺序往里回旋的,觉得很有创意,可是一看源代码头就大了,
每个编程人都知道看别人的代码是很困难的,尤其像这种不知道思路的,所以也就放下
没管了。
昨天上物理课实在是没心思听,就想起这个程序,想了一节课,果然不负有心人,给弄出来了,这个是增强版的,可以输入1-10中的任意个数,然后生成图形。
先看代码,没有注释,所以不好看的懂。
#include<stdio.h>
main()
{
       int n,m,i,j,t,k=1;
       int a[11][11];
       clrscr();
       do{
       printf("please input a number(1-10):");
       scanf("%d",&n);
       }while(n<1||n>10);
       t=n+1;
       for(m=1;m<=t/2;m++)
         {
           for(i=m;i<=t-m;i++)
             {a[i][m]=k;k++;}
           for(j=m+1;j<=t-m;j++)
             {a[i-1][j]=k;k++;}
           for(i=n-m;i>=m;i--)
             {a[i][j-1]=k;k++;}
           for(j=n-m;j>=m+1;j--)
             {a[i+1][j]=k;k++;}
         }
       for(i=1;i<=n;i++)
         {
           for(j=1;j<=n;j++)
             {
               if(a[i][j]<=9) printf("0%d ",a[i][j]);
               else printf("%d ",a[i][j]);       }
           printf("\n");
         }
       getch();
}
就是这样的。


可以更简洁些:

#include<stdio.h>
main()
{
       int n,m,i,j,t,k=1;
       int a[11][11];
       clrscr();
       do{
       printf("please input a number(1-10):");
       scanf("%d",&n);
       }while(n<1||n>10);
       t=n+1;
       for(m=1;m<=t/2;m++)
         {
           for(i=m;i<=t-m;i++)
             a[i][m]=k++;
           for(j=m+1;j<=t-m;j++)
             a[i-1][j]=k++;
           for(i=n-m;i>=m;i--)
             a[i][j-1]=k++;
           for(j=n-m;j>=m+1;j--)
             a[i+1][j]=k++;
         }
       for(i=1;i<=n;i++)
         {
           for(j=1;j<=n;j++)
             {
               if(a[i][j]<=9) printf("0%d ",a[i][j]);
               else printf("%d ",a[i][j]);       }
           printf("\n");
         }
       getch();
}

 


 #include <stdio.h>
#define N 8
main(){
 int i,j,n=1,a[N][N];
 for(i=0;i<=N/2;i++){
  for(j=i;j<N-i;j++)
   a[i][j]=n++;
  for(j=i+1;j<N-i;j++)
   a[j][N-i-1]=n++;
  for(j=N-i-2;j>i;j--)
   a[N-i-1][j]=n++;
  for(j=N-i-1;j>i;j--)
   a[j][i]=n++;
 }
 for(i=0;i<N;i++){
  printf("\n\n");
  for(j=0;j<N;j++)
   printf("%5d",a[i][j]);
 }
}
 

 


                                马踏棋盘问题


#include <stdio.h>
#define N 5
void main(){
 int x,y;
 void horse(int i,int j);
 printf("Please input start position:");
 scanf("%d%d",&x,&y);
 horse(x-1,y-1);
}
void horse(int i,int j){
 int a[N][N]={0},start=0,
  h[]={1,2,2,1,-1,-2,-2,-1},
  v[]={2,1,-1,-2,2,1,-1,-2},
  save[N*N]={0},posnum=0,ti,tj,count=0;
 int jump(int i,int j,int a[N][N]);
 void outplan(int a[N][N]);
 a[i][j]=posnum+1;
 while(posnum>=0){
  ti=i;tj=j;
  for(start=save[posnum];start<8;++start){
   ti+=h[start];tj+=v[start];
   if(jump(ti,tj,a))
    break;
   ti-=h[start];tj-=v[start];
  }
  if(start<8){
   save[posnum]=start;
   a[ti][tj]=++posnum+1;
   i=ti;j=tj;save[posnum]=0;
   if(posnum==N*N-1){
    //outplan(a);
    count++;
   }
  }
  else{
   a[i][j]=0;
   posnum--;
   i-=h[save[posnum>;j-=v[save[posnum>;
   save[posnum]++;
  }
 }
 printf("%5d",count);
}
int jump(int i,int j,int a[N][N]){
 if(i<N&&i>=0&&j<N&&j>=0&&a[i][j]==0)
  return 1;
 return 0;
}
void outplan(int a[N][N]){
 int i,j;
 for(i=0;i<N;i++){
  for(j=0;j<N;j++)
   printf("%3d",a[i][j]);
  printf("\n");
 }
 printf("\n");
 //getchar();
}
用回溯法得到所有的解,但效率较低,只能算出5行5列的

 


Date : 2008-05-05 Size : 4.29kb User : good@588

DL : 0
据说这个程序(omni.com)是97年的Mekka ’97 4K Intro比赛的一等奖作品,整个程序全长4095字节,其中包含133字节的自解压程序(类RAR压缩),未解压的程序长4782字节。三维场景包含144个立方体,367个面,362个点,15个不同的64*64的纹理-said this procedure (omni.com) is the Mekka 97 4K Intro'97 won the competition works, the whole process 4,095 byte length, which includes 133 bytes of self-extracting (RAR compression type), resulting in decompression procedures 4,782 bytes long. 3D cube contains 144, 367-, 362, 15* 64 different texture 64
Date : 2025-12-19 Size : 6kb User : 周伟斌

DL : 0
prolog 找路例子程序: === === === Part 1-Adding connections Part 2-Simple Path example | ?- path1(a,b,P,T). will produce the response: T = 15 P = [a,b] ? Part 3 - Non-repeating path As an example, the query: ?- path2(a,h,P,T). will succeed and may produce the bindings: P = [a,depot,b,d,e,f,h] T = 155 Part 4 - Generating a path below a cost threshold As an example, the query: ?- path_below_cost(a,[a,b,c,d,e,f,g,h],RS,300). returns: RS = [a,b,depot,c,d,e,g,f,h] ? RS = [a,c,depot,b,d,e,g,f,h] ? no ================================== -prolog to find a way examples : ==================================== Part 1-Adding connections Part 2- Simple Path example |- path1 (a, b, P, T). will produce the response : T = 15, P = [a, b] Part 3-Non-repeating path As an example, the query :-path2 (a, h, P, T). will succeed and may produce the bindings : P = [a, depot, b, d, e, f, h] T = 155 Part 4-Generating a path below a cost threshold As an example, the query :-path_below_cost (a, [a, b, c, d, e, f, g, h], RS, 300). returns : RS = [a, b, depot, c, d, e , g, f, h] RS = [a, c, depot, b, d, e, g, f, h] no =====================
Date : 2025-12-19 Size : 2kb User : Fa

DL : 0
商城名称: 新普网络商城XpShop 官方网站: http://www.XpShop.cn/ 初始帐号: admin / admin 最新发布: XpShop .Net 2.4 欢迎使用新普网络商城,XpShop .Net v2.4具有如下特点: 1、使用ASP.Net(c#)、三层结构开发; 2、支持多语言,详细使用方法请咨询新普公司客服; 3、支持多模板,现有版本已经附带5套模板,官方网站不定时发布新模板; 4、兼容主流浏览器,界面美观,皮肤设计灵活多变; 5、可定制缺货处理功能; 6、支持附件销售功能; 7、支持会员组批发功能; 8、支持预付款; 9、自动核算配送价格; 10、商品支持多类别; 11、支持在线备份数据库; 12、支持无限级商品类别; 13、可添加无限多种商品扩展属性,并可将扩展属性加入高级搜索; 14、支持多管理员,可自由设定管理员的可管理项; 15、自动生成报价单,商品价格一目了然; 16、用UTF-8编码,适用在全球各地的网络空间运行; 17、集成多种在线支付方式,除国内的主流支付方式支付宝、网银在线,贝宝外,还集成了适合于国外支付的Paypal和网银在线外卡; 18、不断升级,并可免费下载使用;-place names : New Pronk network Mall XpShop official website : http :// www.XpShop.cn/ initial account : admin/admin latest release : XpShop. Net 2.4 Pronk welcomed the use of new network Mall, XpShop. Net time monitor has the following characteristics : 1, the use of ASP.Net (c#) the three-tier structure development; 2, multi-language support, detailed advice please use the new Cape company customer service; 3, for the multi- template the current version has five sets of templates fringe, the official web site regularly releases new templates; 4, compatible browser mainstream, beautiful interface, Design flexibility of the skin; 5 and can be customized understocked processing functions; 6, Annex sales support functions; 7. Group members support the wholesale function; 8, support adv
Date : 2025-12-19 Size : 3.02mb User : songshubo

V2Packer code by tt.t with almost pure delphi first build @ 2006.4.15 看到過許多別人寫的殼,大多是asm,也有的是c。早就想試一試用比較“純”的delphi 寫會是什麼樣子,於是就有了V2Packer。 V2Packer斷斷續續寫了半個月的時間,資源部分代碼寫的很垃圾,只算是能用。PEAnalyst類 由於改變了思路,去掉了一些東西,現在成了PEHeader類的再包裝。 代碼中的{$INCLUDE DePack.pas }是因為d6的ide不支持代碼摺疊,就把一些代碼移到了 單獨的單元。 DePack.pas中用了一個非常簡單而且不安全的anti-debug trick,很可能有危險,不過 姑且放在那裡吧。 代碼中肯定有bug,不過測試中沒發現大問題,作為自娛自樂的產物就算說得過去了。 程序寫的思路比較清晰,如果對感興趣,可以從DoPack函數看起。 希望能對為數不多的用delphi寫這累東西的初學者有一些幫助。 !請不要將這些代碼用於非法用途!-V2Packer code by tt.t with almost pure delp hi first build@2006.4.15 seen many people write the carcasses, mostly asm2. c while others. Had long ago wanted to try a more "pure" delphi write what is, so there will be a V2Packer. V2Packer write off half of the time and resources of the code is written rubbish is only can be used. PEAnalyst category owing to a change in the thinking and get rid of some stuff PEHeader now become a kind of repackaging. The code () $ INCLUDE DePack.pas because d6, B3 does not support the ide code folding , put some code moved to a separate unit. DePack.pas using a very simple and insecure anti-debug trick , it is very likely it is dangerous, but to give it on there. I am sure that code bug, but tests found no major problems, as the product even enterta
Date : 2025-12-19 Size : 514kb User :

一个算术表达式是由操作数(operand)、运算符(operator)和界限符(delimiter)组成的。假设操作数是正整数,运算符只含加减乘除等四种运算符,界限符有左右括号和表达式起始、结束符“#”,如:#(7+15)*(23-28/4)#。引入表达式起始、结束符是为了方便。编程利用“算符优先法”求算术表达式的值。用C语言实现-An arithmetic expression by the operand (operand), operator (operator) and the Limits of Fu (delimiter), composed of. Assumptions operand is a positive integer, operator calculation containing only four operators, have limits of around brackets and at the start expression, at the end of
Date : 2025-12-19 Size : 305kb User : 张晓娟

DL : 0
用C++中的MFC编程实现正轴等角割圆柱投影,实现以下要求: 取克拉索夫斯基椭球 (1)制图区域: Bs=0°, BN=25° LE=105°, LE=125° (2)经纬线间隔: ΔB=ΔL=5° (3)制图比例尺: 1:M0=1:1000 000 (4)标准纬线: Bk=±15° 计算经纬网格点的 x, y,m,n, p -With C++ Of MFC programming is cutting Conformal cylindrical projection axis to achieve the following requirements: check克拉索Malinowski ellipsoid (1) mapping the region: Bs = 0 °, BN = 25 ° LE = 105 °, LE = 125 ° (2) latitude and longitude line spacing: ΔB = ΔL = 5 ° (3) Drawing scale: 1: M0 = 1:1000 000 (4) the standard parallels: Bk = ± 15 ° latitude and longitude grid computing point x , y, m, n, p
Date : 2025-12-19 Size : 40kb User : 张建

DL : 0
1. Matrix-chain product. The following are some instances a) <3, 5, 2, 1,10> b) <2, 7, 3, 6, 10> c) <10, 3, 15, 12, 7, 2> d) <7, 2, 4, 15, 20, 5> -1. Matrix-chain product. The following are some instancesa) <3, 5, 2, 1,10> b) <2, 7, 3, 6, 10> c) <10, 3, 15, 12, 7, 2> d) <7, 2, 4, 15, 20, 5>
Date : 2025-12-19 Size : 1kb User : caoruntao

DL : 0
手机通讯录管理系统, 要求: (1) 查看功能:选择此功能时列出下列三类功能. A办公类 B个人类 C商务类 当选中某类时,显示出此类所有数据中的姓名和电话号码 (2)增加功能:能录入新数据,一个结点包括:姓名,电话号码,分类(办公类,个人类,商务类), 电子邮件,类如:杨春 13567772898 商务类 chuny@126.com。当录入重复的姓名和电话号码,则提示数 据录入重复并取消录入,当通讯录中超过15条信息时存储空间已满,不能再录入新数据,录入的数据能 按递增的顺序自动进行编号 (3)修改功能:选中某个人的姓名时,可对此人的相应数据进行修改。 (4)删除功能:选中某个人的姓名时,可对此人的相对数据进行删除并自动调整后续条目的编号, -err
Date : 2025-12-19 Size : 3kb User : 陈秋炜

DL : 0
某次考试有20个单项选择题,下面是这20个题的正确答: //* 1.B 2.D 3.A 4.A 5.C 6.A 7.B 8.A 9.C 10.D //* 11.B 12.C 13.D 14.A 15.D 16.C 17.C 18.B 19.D 20.A //* 采用数组存储上述20个标准答案,要求用户输入考生的答 //* 案,并采用另一个数组存储,程序显示该生是否通过考试, //* 并显示考生答错的题数和题号。-A second examination 20 multiple-choice individual, the following is the correct title 20 Answer://* 1.B 2.D 3.A 4.A 5.C 6.A 7.B 8.A 9.C 10.D//* 11.B 12.C 13.D 14.A 15.D 16.C 17.C 18.B 19.D 20.A//* using an array of storage above 20 standard answer that requires a user to Enter the candidate s FOR//* case, and uses another array to store, process shows whether the student passed the exam,//* and display the number of candidates got the wrong answer and the question of its title.
Date : 2025-12-19 Size : 1kb User : yann

DL : 1
本程序是用来计算两个整数之间的所有素数的。 反复运用了6k+-1的素数纯度比较高的性质。 由于采用的是double型数据,故可将范围扩大至 1位数---15位数,不过由于程序调整,所属如范围 与所得范围间有一个6倍关系 该程序可用vc++6.0,或者cfree3.5,---4.0都可以正常编译,如有运行异常,可按Ctrl+c,强行中止!-This program is used to calculate the two integers all prime numbers between. Repeatedly used the 6k+-1 primes relatively high purity of nature. As a result of the double type data, it can be extended to a median--- 15-digit, but due to program adjustments, such as the scope and the proceeds belong there is a six-fold between the scope of the relationship between the program can be used vc++6.0, or cfree3.5,--- 4.0 can be a normal compile, run, if abnormal, can Ctrl+ c, forced the suspension!
Date : 2025-12-19 Size : 2kb User : 赖海燕

c(est un document qui contient le code source d un protocole IEEE802.15.4 zigb-c(est un document qui contient le code source d un protocole IEEE802.15.4 zigbee
Date : 2025-12-19 Size : 108kb User : intissar

DL : 0
北邮复试上机题目: Description 子矩阵旋转操作。 Input 前5行每行5个整数,表示一个5*5阶的矩阵。 第6行为4个整数a b c d,根据这4个整数进行相应的旋转操作。 Output 若a b分别为1 2,则将原矩阵中以第c行第d列元素为左上角的2*2阶子矩阵顺时钟旋转90度后输出原矩阵。 若a b分别为1 3,则将原矩阵中以第c行第d列元素为左上角的3*3阶子矩阵顺时钟旋转90度后输出原矩阵。 若a b分别为2 2,则将原矩阵中以第c行第d列元素为左上角的2*2阶子矩阵逆时钟旋转90度后输出原矩阵。 若a b分别为2 3,则将原矩阵中以第c行第d列元素为左上角的3*3阶子矩阵顺时钟旋转90度后输出原矩阵。 Sample Input 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 3 1 1 Sample Output 11 6 1 4 5 12 7 2 9 10 13 8 3 14 15 16 17 18 19 20 21 22 23 24 25- Description Sub-matrix of the rotation operation. Input The first five lines of each row of five integers, indicating that the order of a 5* 5 matrix. 6 behavior of four integer abcd, according to the four integer corresponding rotation operation. Output If ab 12, column c line d is the original matrix elements of order 2* 2 submatrix of the upper-left corner clockwise rotation of 90 degrees after the output of the original matrix. Ab, respectively, 13, is the original matrix c line d column elements for the upper-left corner of the 3* 3 order sub-matrix clockwise 90 degrees, the output of the original matrix. If ab were 22, column c line d is the original matrix elements for the upper left corner 2* 2 order sub-matrix counterclockwise rotation of 90 degrees, the output of the original matrix. Ab, respectively, 23, is the original matrix c line d column elements for the upper-left corner of the 3* 3 order sub-matrix clockwise 90 degrees, the output of the original matrix. S
Date : 2025-12-19 Size : 380kb User : Jeniffer1

DL : 0
VC/C++源码,文件操作,浩方   最近迷上了魔兽真三国无双,但是一次一次的挤房间然我很不爽,本程序将自动尝试进入浩方真三菜鸟房的40-60号房间。先需要进浩方然后选 竞技-真三-上海专区。   浩方自动进菜鸟房,编程思路:   1.用SPYXX分析窗口结构,取得父窗体以及那个ListView窗体的句柄   2.发送LVM_GETITEMPOSITION消息取得坐标   3.发送WM_LBUTTONDBLCLK模拟鼠标双击   4.设定在15秒内,看是否出现人满的那个提示窗口,出现则关闭他,继续下一个房间,如果到了最后一个房间则又从头开始,如果没有出现,则认定成功进入,3秒后退出。    -VC/C++ source code, file operations, Holdfast recently hooked Warcraft Dynasty Warriors, but once crowded room contingent me very uncomfortable, the program will automatically attempt to enter the room of the Holdfast really three rookie 40-60 Room. First into the Holdfast then choose competitive- really three- Shanghai area. The Holdfast auto rookie room, programming ideas: 1. SPYXX analysis window structure to obtain a handle to the parent form, and that the ListView form. Send LVM_GETITEMPOSITION message to obtain the coordinates 3. Send WM_LBUTTONDBLCLK simulate double-clicking. Set within 15 seconds , to see whether there is full, prompt, and appear close to him, and continue to the next room, to the last room you start again from scratch, if it does not appear, identified successful entry into and exit in 3 seconds.
Date : 2025-12-19 Size : 18kb User : 李宗浩

DL : 0
skiing 时间限制:3000 ms | 内存限制:65535 KB 难度:5 描述 Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 一个人可以从某个点滑向上下左右相邻四个点之一,当且仅当高度减小。在上面的例子中,一条可滑行的滑坡为24-17-16-1。当然25-24-23-...-3-2-1更长。事实上,这是最长的一条。 输入 第一行表示有几组测试数据,输入的第二行表示区域的行数R和列数C(1 <= R,C <= 100)。下面是R行,每行有C个整数,代表高度h,0<=h<=10000。 后面是下一组数据; 输出 输出最长区域的长度。 样例输入 1 5 5 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 样例输出 25-skiing Time Limit : 3000 ms | Memory Limit : 65535 KB Difficulty: 5 Description Michael likes to ski one hundred This is not surprising , because skiing is very exciting. However, in order to gain speed , the area must be downward slide , and when you slide into the base , you have to lift up the grade again or wait for you to upload . Michael wanted to know an area set up at the end landslide . Given by a two-dimensional area array . Each number represents the height of the point of the array . Here is an example 12345 161718196 152425207 142322218 131211109 A person can slide up and down from a point adjacent to one of the four points , and only when the height is reduced. In the above example , one can slide the sliding 24-17-16-1 . Of course 25-24-23- ...-3-2-1 longer. In fact, this is the longest one . Enter The first line indicates that there are several sets of test data, the second line of the input area , said the number of rows and columns R C (1 <=
Date : 2025-12-19 Size : 1kb User : Qinzhen

DL : 0
802.15.4mac层协议实现,c++文件,-the completion of 802.15.4 Media Access Control layer,c++ files
Date : 2025-12-19 Size : 355kb User : 浪荡子

it is IEEE 802.15.4 code part
Date : 2025-12-19 Size : 525kb User : FMH

it is WBAN code in IEEE 802.15.4
Date : 2025-12-19 Size : 684kb User : FMH

it is WBAN code in IEEE 802.15.4. xvv
Date : 2025-12-19 Size : 223kb User : FMH

ieee 802.15.4 standard for working
Date : 2025-12-19 Size : 2kb User : FMH
« 12 »
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.