| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2337 人关注过本帖
标题:我的数构课设——最短路径(有问题:最短路径显示不了)
只看楼主 加入收藏
kaitlynyl
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-2-16
收藏
 问题点数:0 回复次数:12 
我的数构课设——最短路径(有问题:最短路径显示不了)
这是我这学期的数据结构课设成果,关键的东西没出来,可是老师给我良,因为我们专业只有两个人支持鼠标了,我知道这在各位眼里很初级,但是我觉得我才大二,以后的路还很长,所以想学学,想知道我的为什么关键的无法显示,我是一个女生,知道男生对编程应该更在行一些,但是我不服输,我希望各位能指点我,我会很感激的,谢谢(图片换用其他)

/*第一句为音频文件编译开关,为主函数中的音频服务*/
#define NEO_sound_used
#include "neo.h"
#include<process.h>
#define closegr closegraph
#define INFINITY  10000
#define TRUE  1
#define FALSE 0
#define INT_MAX 10000
 typedef struct{
unsigned int arcs[16][16];
int vexnum;
}bqGraph;
 typedef struct{
unsigned int arcs[16][16];
int vexnum;
}dqGraph;
beiqu();
daohang();
/*tu1-11为本程序使用的图片调用*/
tu1()
{
    FILE *fp;
    fp="jieshao.bmp";
    return fp;
}

tu2()
{FILE *fp;
 fp="qiang.bmp";
 return fp;
}


tu3()
{FILE *fp;
 fp="tupian.bmp";
 return fp;
}
 tu4()
{FILE *fp;
 fp="help.bmp";
 return fp;
}
tu5()
{
    FILE *fp;
    fp="dzhulou.bmp";
    return fp;
}
tu6()
{
    FILE *fp;
    fp="jin-qiu.bmp";
    return fp;
}
tu7()
{
    FILE *fp;
    fp="bjieshao.bmp";
    return fp;
}
tu8()
{
    FILE *fp;
    fp="bqzhulou.bmp";
    return fp;
}
tu9()
{
    FILE *fp;
    fp="bye.bmp";
    return fp;
}

tu10()
{
    FILE *fp;
    fp="jing.bmp";
    return fp;
}
tu11()
{
    FILE *fp;
    fp="heart.bmp";
    return fp;
}


bqchaxun()     /*北区最短路径*/
{
     int k,j,v,u,i,w,v0,g,m,n,p[17][17][17],D[17][17];
        bqGraph G1;
     show_bmp(tu11(), 0, 0);
     install_keyboard();
        install_mouse(); /*安装高级鼠标例程*/

   _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/

 


       set_str_color(_LIGHTGREEN);
       set_str_blank(50);
     set_cn_size(9);


string_out("请选择您所在的地点和您的目的地,",80,40);
string_out("我们将为您提供两地点之间的路径导游服务。",40,70);


string_out("0、西门",140,110);
string_out("1、阶梯教室",140,142);
string_out("2、餐厅",140,174);
string_out("3、宿舍楼",140,206);
string_out("4、教育超市",140,238);
string_out("5、操场",140,270);
string_out("6、运动馆",325,110);
string_out("7、篮球场",325,142);
string_out("8、荷花池",325,174);
string_out("9、礼仪广场",325,206);
string_out("10、正门",325,238);
string_out("11、主楼",325,270);
string_out("请输入您所需查询路径的起点和终点:",80,320);
 readkey();  v0=(int)readkey();
        while (!keypressed());

          readkey();
          g=(int)readkey();while (!keypressed());
                 k=v0;j=g;

 


set_str_color(_LIGHTCYAN);
set_cn_font(S24X24, "HZK24S");
string_out("返回上一级",20,445);
         while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{
              switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
           {   switch(get_click_info())
             {case 1 : daohang();

             }
           }

       }


        switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=413&&n>=420&&m<=610&&n<=450)
                  { switch(get_click_info())

                          {    case 1:

      beiqu();

                          }


                  }
       }


}
        for(v=0;v<=17;v++)
    for(w=0;w<=17;w++)
     {G1.arcs[v][w]=INFINITY;}

  G1.arcs[0][12]=26;
  G1.arcs[1][11]=18;   G1.arcs[1][12]=25;   G1.arcs[1][13]=28;
  G1.arcs[2][11]=25;   G1.arcs[2][12]=18;   G1.arcs[2][15]=22;
  G1.arcs[3][15]=12;
  G1.arcs[4][5]=22;   G1.arcs[4][6]=14;    G1.arcs[4][15]=37;
  G1.arcs[6][7]=12;
  G1.arcs[7][8]=37;   G1.arcs[7][14]=28;
  G1.arcs[8][11]=22;  G1.arcs[8][15]=25;
  G1.arcs[9][10]=14;  G1.arcs[9][11]=14;
  G1.arcs[10][13]=18; G1.arcs[10][14]=59;

  for(v=0;v<=17;v++)
    for(w=0;w<=17;w++)
      if(G1.arcs[v][w]<INFINITY)
        G1.arcs[w][v]=G1.arcs[v][w];

 


  for(v=0;v<17;v++)
  for(w=0;w<17;w++)
   {
   D[v][w]=G1.arcs[v][w];
       for(u=0;u<17;u++)
       {p[v][w][u]=0;}
   if(D[v][w]<INFINITY)
       {p[v][w][v]=1;p[v][w][w]=1;
       }
   }

 

 


for(u=0;u<17;u++)
  for(v=0;v<17;v++)
    for(w=0;w<17;w++)
      if(D[v][u]+D[u][w]<D[v][w])
        {D[v][w]=D[v][u]+D[u][w];
        for(i=0;i<17;i++)
        {p[v][w][i]=p[v][u][i]||p[u][w][i];

        }}
     printf("%d",k);
         for(u=0;u<16;u++)
   {
            if(p[k][j][u]&&k!=u&&j!=u)
     {
       printf("-->%d",u);
     }
   }
         printf("-->%d",j);

          getch();

     }

 

 

 

/*************************************************************************/

 beiqu()         /*北区图的生成*/
{
 int m,n;
neo_init();
set_video_mode(640,480,16, 75, 0);

             show_bmp(tu8(), 0, 0);

 


 circlefill(120,140,10,_LIGHTMAGENTA); /*路口1西门餐厅*/
circlefill(120,420,10,_YELLOW); /*路口2阶教下方*/
circlefill(500,420,10,_YELLOW); /*路口3篮球场下方*/
circlefill(330,140,10,_YELLOW); /*路口4宿舍楼下方*/

 

circlefill(40,140,10,_YELLOW);
  /*西门*/

circlefill(570,140,10,_YELLOW);
  /*操场*/

circlefill(500,140,10,_YELLOW);
 /*教育超市*/
circlefill(500,200,10,_YELLOW);
  /*校医院*/
circlefill(500,250,10,_YELLOW);
   /*运动馆*/

circlefill(120,320,10,_YELLOW);
  /*阶教*/
circlefill(220,320,10,_YELLOW);
/*主楼*/
circlefill(330,320,10,_YELLOW);
 /*荷花池*/
circlefill(330,80,10,_YELLOW);
   /*宿舍楼*/
circlefill(500,320,10,_YELLOW);
  /*篮球场*/

circlefill(220,370,10,_YELLOW);
 /*礼仪广场*/
circlefill(220,420,10,_YELLOW);
  /*正门*/
circlefill(220,140,10,_YELLOW);
   /*餐厅*/

line(50,141,110,141,_YELLOW);
line(231,141,320,141,_YELLOW);
line(511,141,561,141,_YELLOW);
line(130,141,210,141,_YELLOW);
line(340,141,490,141,_YELLOW);

line(130,321,211,321,_YELLOW);
line(230,321,320,321,_YELLOW);
line(340,321,490,321,_YELLOW);

line(500,260,500,310,_YELLOW);
line(500,210,500,240,_YELLOW);
line(500,151,500,190,_YELLOW);

line(121,150,121,310,_YELLOW);
line(220,150,220,310,_YELLOW);
line(220,330,220,360,_YELLOW);
line(220,380,220,410,_YELLOW);
line(331,90,331,130,_YELLOW);
line(331,150,331,310,_YELLOW);

 

line(130,420,210,420,_YELLOW);
line(120,330,120,410,_YELLOW);
line(230,420,490,420,_YELLOW);
line(500,330,500,410,_YELLOW);
set_str_color(_LIGHTGREEN);
set_str_blank(50);
set_cn_size(9);
string_out("西门",20, 160);

string_out("操场",560, 155);
string_out("教育超市",470, 110);
string_out("校医院",513, 190);
string_out("运动馆",513, 240);
string_out("篮球场",520, 310);
string_out("主楼",233, 300);

string_out("路口",130,150);
string_out("路口",75,410);

string_out("路口",513,410);
string_out("路口",340,150);


string_out("阶梯教室",40, 310);
string_out("荷花池",340, 300);
string_out("宿舍楼", 308, 45);
string_out("礼仪广场",235, 360);
string_out("正门",204, 435);
string_out("餐厅",210, 110);

 

set_str_color(_YELLOW);
set_cn_font(S24X24, "HZK24S");
string_out("北",55, 45);
string_out("区",120, 45);
set_str_color(_LIGHTCYAN);
set_cn_font(S24X24, "HZK24S");
string_out("返回上一级",20,445);
  while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{

 

        switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
           {   switch(get_click_info())
             {  case 1 : bqchaxun();

             }
           }

       }
 }
getch();


}

dqchaxun()   /*东区最短路径*/
{
     int k,j,v,u,i,w,v0,g,m,n,p[16][16][16],D[16][16];
     dqGraph G1;
    show_bmp(tu10(), 0, 0);
     install_keyboard();
      install_mouse(); /*安装高级鼠标例程*/
          _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
       set_str_color(_LIGHTGREEN);
       set_str_blank(50);
     set_cn_size(9);
        string_out("请选择您所在的地点和您的目的地,",80,40);
        string_out("我们将为您提供两地点之间的路径导游服务。",40,70);
        string_out("0、校门",140,110);
        string_out("1、主楼",140,142);
        string_out("2、宿舍",140,174);
        string_out("3、篮球场",140,206);
        string_out("4、图书馆",140,238);
        string_out("5、餐厅",140,270);
        string_out("6、操场",325,110);
        string_out("7、科技大厦",325,142);
        string_out("8、博士生楼",325,174);
        string_out("9、宿舍楼",325,206);
        string_out("10、礼堂",325,238);
        string_out("请输入您所需查询路径的起点和终点:",80,320);
         readkey();  v0=(int)readkey();
        while (!keypressed());
          readkey();
          g=(int)readkey();while (!keypressed());
                 k=v0;j=g;
         set_str_color(_LIGHTCYAN);
         set_cn_font(S24X24, "HZK24S");
         string_out("返回上一级",20,445);
         while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{
              switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
           {           switch(get_click_info())
             {               case 1 : daohang();

             }
           }

       }


                       switch(get_click_info())

      {                      case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=322&&n>=430&&m<=515&&n<=455)
                  {    switch(get_click_info())

                              {    case 1:

                                               dongqu();

                              }


                  }
       }


}                                /*图的初始化*/
         for(v=0;v<16;v++)
         for(w=0;w<16;w++)
         G1.arcs[v][w]=INFINITY;
   G1.arcs[0][1]=26;
  G1.arcs[1][12]=20;
   G1.arcs[1][13]=54;
  G1.arcs[2][3]=36;
    G1.arcs[2][12]=44;
  G1.arcs[3][4]=44;
    G1.arcs[3][16]=20;
  G1.arcs[4][5]=20;
   G1.arcs[4][12]=36;
  G1.arcs[5][9]=72;
   G1.arcs[5][14]=24;
    G1.arcs[5][16]=45;
  G1.arcs[6][14]=46;
   G1.arcs[6][16]=24;
  G1.arcs[7][8]=30;
   G1.arcs[7][11]=40;
     G1.arcs[7][14]=30;
  G1.arcs[8][15]=30;
  G1.arcs[9][10]=42;
  G1.arcs[9][11]=24;
  G1.arcs[10][13]=18;
  G1.arcs[14][15]=30;

  for(v=0;v<16;v++)

     for(w=0;w<16;w++)

        if(G1.arcs[v][w]<INFINITY)
           G1.arcs[w][v]=G1.arcs[v][w];

 


  for(v=0;v<16;v++)
     for(w=0;w<16;w++)
        {
             D[v][w]=G1.arcs[v][w];
               for(u=0;u<16;u++)
                  {  p[v][w][u]=0;}
               if(D[v][w]<INFINITY)
                {    p[v][w][v]=1;p[v][w][w]=1;
                 }
        }


for(u=0;u<16;u++)
  for(v=0;v<16;v++)
    for(w=0;w<16;w++)
      if(D[v][u]+D[u][w]<D[v][w])
        {             D[v][w]=D[v][u]+D[u][w];
                          for(i=0;i<16;i++)
                              {     p[v][w][i]=p[v][u][i]||p[u][w][i];

                               }
        }
     printf("%d",k);
         for(u=0;u<16;u++)
   {
            if(p[k][j][u]&&k!=u&&j!=u)
     {
       printf("-->%d",u);
     }
   }
         printf("-->%d",j);

          getch();

}


 dongqu()     /*东区图*/
{
 int m,n;
neo_init();
set_video_mode(640,480,16, 75, 0);
  show_bmp(tu6(), 0, 0);
  circlefill(150,110,10,_LIGHTMAGENTA);
   circlefill(150,220,10,_LIGHTMAGENTA);
     circlefill(150,310,10,_LIGHTMAGENTA);
      circlefill(240,175,10,_LIGHTMAGENTA);
       circlefill(240,220,10,_LIGHTMAGENTA);
        circlefill(330,310,10,_LIGHTMAGENTA);
         circlefill(330,380,10,_LIGHTMAGENTA);
          circlefill(490,265,10,_LIGHTMAGENTA);
           circlefill(490,175,10,_LIGHTMAGENTA);
            circlefill(295,110,10,_LIGHTMAGENTA);
             circlefill(295,50,10,_LIGHTMAGENTA);
               circlefill(490,110,10,_LIGHTMAGENTA); /*路口1宿舍楼那里*/
                circlefill(240,310,10,_LIGHTMAGENTA);  /*路口2主楼图书馆那里*/
                 circlefill(490,310,10,_LIGHTMAGENTA);  /*路口3礼堂那里*/
                   circlefill(240,110,10,_LIGHTMAGENTA);  /*路口4科技大厦*/
                     circlefill(240,50,10,_LIGHTMAGENTA);   /*路口5博士生楼那里*/
                      circlefill(150,175,10,_LIGHTMAGENTA);  /*操场和篮球场之间*/
 set_str_color(_LIGHTGREEN);
  set_str_blank(50);
   set_cn_size(9);
    string_out("校门",315, 397);
     string_out("篮球场",90, 215);
      string_out("宿舍",105, 300);
        string_out("餐厅",250, 155);
          string_out("图书馆",255, 210);
            string_out("主楼",313, 282);
             string_out("礼堂",503, 260);
              string_out("路口",504,100);
                string_out("路口",225,323);
                 string_out("路口",504,305);
                  string_out("路口",195,90);
                   string_out("路口",195,43);
                    string_out("路口",100,170);
                     string_out("路口",100,170);
                      string_out("操场",100, 100);
                       string_out("宿舍楼",500, 165);
                         string_out("科技大厦",280, 123);
                          string_out("博士生楼",310, 43);
 set_str_color(_YELLOW);
set_cn_font(S24X24, "HZK24S");
string_out("东",590, 73);
string_out("区",590, 173);
line(160,176,230,176,_LIGHTMAGENTA);
line(151,229,151,300,_LIGHTMAGENTA);
line(151,119,151,165,_LIGHTMAGENTA);
line(151,185,151,210,_LIGHTMAGENTA);
line(240,60,240,100,_LIGHTMAGENTA);
line(240,120,240,165,_LIGHTMAGENTA);
line(250,53,287,53,_LIGHTMAGENTA);
line(159,311,230,311,_LIGHTMAGENTA);
line(250,311,320,311,_LIGHTMAGENTA);
line(329,320,329,372,_LIGHTMAGENTA);
line(240,230,240,300,_LIGHTMAGENTA);
line(240,185,240,210,_LIGHTMAGENTA);
line(250,175,480,175,_LIGHTMAGENTA);
line(160,111,230,111,_LIGHTMAGENTA);
line(250,111,285,111,_LIGHTMAGENTA);
line(295,60,295,100,_LIGHTMAGENTA);
line(305,111,480,111,_LIGHTMAGENTA);
line(490,122,490,165,_LIGHTMAGENTA);
line(490,185,490,255,_LIGHTMAGENTA);
line(340,312,480,312,_LIGHTMAGENTA);
line(490,277,490,300,_LIGHTMAGENTA);
line(160,220,230,220,_LIGHTMAGENTA);
set_str_color(_LIGHTCYAN);
set_cn_font(S24X24, "HZK24S");
string_out("返回上一级",20,445);
  while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{      switch(get_click_info())

             {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
                       {     switch(get_click_info())
                                  {   case 1 : dqchaxun();

                                   }
                        }

             }
 }
getch();
}
dqintro()      /*东区介绍*/
{        int m,n;
       show_bmp(tu5(), 0, 0);

      install_mouse(); /*安装高级鼠标例程*/
     _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
     while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
     {            switch(get_click_info())
                  {        case 1:   m=get_mouse_x();
                        n=get_mouse_y();
                  if(m>=400&&n>=380&&m<=580&&n<=430)/*用户选择返回上一级*/
           {        switch(get_click_info())
                          {       case 1 :daohang();

                           }
           }
                   }
     } getch();
}
bqintro()       /*北区介绍*/
{     int m,n;
      show_bmp(tu7(), 0, 0);
      install_mouse(); /*安装高级鼠标例程*/
      _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
      while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
      {      switch(get_click_info())
                 {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                       if(m>=185&&n>=403&&m<=428&&n<=455)
                              /*用户选择返回上一级*/
                         {    switch(get_click_info())
                                    {     case 1 : daohang();
                                     }
                         }
                 }
     } getch();
}
intro()        /*介绍*/
{    int z,w;
      show_bmp(tu1(), 0, 0);
       install_mouse(); /*安装高级鼠标例程*/
         _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
      while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
   {      switch(get_click_info())
                {    case 1:
                           z=get_mouse_x();
                           w=get_mouse_y();
                if(z>=205&&w>=361&&z<=445&&w<=420) /*返回上一级*/
                  {    switch(get_click_info())
                     {case 1:mouse();
                     }
                   }
                 }
    }       getch();
}

huanying()   /*最开始的欢迎界面*/
{  show_bmp(tu3(), 0, 0);
     install_mouse(); /*安装高级鼠标例程*/

   _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/

}
daohang()     /*学校红墙图片,导航界面*/
{    int z,w;
      show_bmp(tu2(), 0, 0);
        install_mouse(); /*安装高级鼠标例程*/
         _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
             while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{                switch(get_click_info())

                      {    case 1:
                                       z=get_mouse_x();
                                      w=get_mouse_y();
                         if(z>=40&&w>=120&&z<=180&&w<=145)/*东区景点介绍*/
                           {
                                       switch(get_click_info())

                                      {     case 1:
                                            dqintro();
                                      }
                           }
                        if(z>=460&&w>=120&&z<=610&&w<=145)/*东区最佳路线*/
                           {      switch(get_click_info())
                                  {case 1:
                                 dqchaxun();
                                  }
                           }
                       if(z>=40&&w>=230&&z<=180&&w<=260)/*北区景点介绍*/

                            {            switch(get_click_info())
                                 {case 1:  bqintro();
                                  }

                             }


                        if(z>=460&&w>=230&&z<=610&&w<=260)/*北区最佳路线*/
                         {          switch(get_click_info())
                                  {   case 1:
                                      bqchaxun();
                                  }
                          }
                       if(z>=20&&w>=380&&z<=245&&w<=433)/*返回主界面*/

                        {    switch(get_click_info())

                                   {case 1:

                                  mouse();

                                   }

                         }
     }}
}
help()             /*阶教图片,帮助*/
{      int z,w;
   show_bmp(tu4(), 0, 0);
                      install_mouse(); /*安装高级鼠标例程*/

   _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
                while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
           {      switch(get_click_info())
                          {    case 1:
                                z=get_mouse_x();
                                w=get_mouse_y();
                if(z>=205&&w>=345&&z<=448&&w<=400) /*tu4中的返回主界面*/
                {    switch(get_click_info())
                            {       case 1:
                                          mouse ();
                            }

                 }
                          }
           }             getch();

}


mouse()           /*整个鼠标全局的操作*/
{  int x,y;
    neo_init();
  set_video_mode(640,480,16, 75, 0); /*进入640X480,16位图形模式*/
  huanying();

     while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{          switch(get_click_info())
                                 
      {    case 1:

                 x=get_mouse_x();
                 y=get_mouse_y();
              if(x>=240&&y>=225&&x<=403&&y<=258)/*进入导航页面*/
           {         switch(get_click_info())

                       {case 1:     daohang();

                        }


            }

             /*以下为帮助算法*/
                 if(x>=240&&y>260&&x<=403&&y<=289)/*主界面帮助键*/
           {
                  switch(get_click_info())
                          {   case 1:
                                     help();

                           }

           }

/******************************以下北化介绍*************************************/
                if(x>=240&&y>290&&x<=403&&y<=318)
                {         switch(get_click_info())
                               {           case 1:  intro();
                               }
                  }
 /***************************************************************************/
               /*主界面的退出*/
                     if(x>=240&&y>320&&x<=403&&y<=350)
     {         switch(get_click_info())
              {   case 1:

               show_bmp(tu9(), 0, 0);
              install_mouse(); /*安装高级鼠标例程*/

             _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
              getch();
              }

     }
   } /*最初的switch*/

 }  /*while*/


}/*mouse*/

main()/*主函数中最后添加了音频文件,就一句话:“Mission accomplished!"*/
{  
   SAMPLE *wav;
      neo_init();  mouse();
   install_keyboard();
   install_sound();  /*安装音频例程*/
   wav = load_wav("win.wav"); /*读入一个音频采样*/

   play_sample_ex(wav, 0,0,0,0);   /*单次播放音频采样*/
   readkey();
   stop_sample(wav); /*中止音频采样*/

    return;
 }
搜索更多相关主题的帖子: 路径 
2008-02-16 17:09
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 
回复 1# 的帖子
你在编译时应该会看到许多警告,编写无错误无警告的程序是非常重要的,虽然警告不影响EXE执行文件的生成,但会对程序造成各种隐患。我先说一下程序中可能会造成编译警告的问题:

#define TRUE  1
#define FALSE 0
这两个宏NEO SDK中已经定义,可以直接使用,再次定义会造成重定义警告;

tu1() /* 不规范的写法,定义函数时需要指出返回值的类型,如果不想返回任何值,应使用 void */
{
    FILE *fp;
    fp="jieshao.bmp";/* 将一个字符串常量的指针赋值给FILE类型指针,类型不匹配导致警告 */
    return fp;/* 在函数名外未指出返回值类型,TC默认将返回一个int整型值,而fp是一个FILE指针,类型不匹配导致报警 */
}
其它的tu2()、tu3()、tu4()等函数都存在相同的问题,我粗略的看了下你的代码,你的这一批函数都被当作参数传递给了show_bmp(),为什么你不直接show_bmp("tupian.bmp", 0, 0);而写成show_bmptu3(), 0, 0);呢?

请先修改代码直至无警告,我们再继续讨论程序逻辑的问题,也希望今后你在论坛上发代码也确保不会在编译时产生很多警告,偶尔一两个警告可能只是告诉帮助你的人:“嘿,这家伙很粗心”,但成批出现的警告只会让别人失去继续调试的兴趣,而且也是一种对阅读代码者的不礼貌,加油!
2008-02-16 20:09
xianshizhe111
Rank: 1
等 级:新手上路
帖 子:1451
专家分:0
注 册:2007-12-8
收藏
得分:0 
楼主厉害呀.
2008-02-17 01:30
kaitlynyl
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-2-16
收藏
得分:0 
回复 2# 的帖子
我们刚刚学完谭浩强的C语言和严蔚敏的数据结构,对于警告老师说先别管,格式老师也没有讲过,实话说我对现在大学的自学式教学很不适应,还有那个你说的直接用那个函数的问题,我们老师说什么要把东西都放主函数外,而且规定了必须要用文件,想要让我们复习一下c语言。我们老师年纪比较大,所以有些东西学的有问题。老师告诉过我,说我的格式很乱,给别人他们都不会爱看的,呵呵~谢谢你,我会在下学期的学习中注意的o(∩_∩)o...这个程序的问题我想等我修改好了再问你好吗?^-^

[[it] 本帖最后由 kaitlynyl 于 2008-2-18 15:30 编辑 [/it]]
2008-02-18 15:22
kaitlynyl
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-2-16
收藏
得分:0 
回复 2# 的帖子
这次没有多少警告了……
/*第一句为音频文件编译开关,为主函数中的音频服务*/
#define NEO_sound_used
#include "neo.h"
#include<process.h>
#define closegr closegraph
#define INFINITY  10000

#define INT_MAX 10000
 typedef struct{
unsigned int arcs[16][16];
int vexnum;
}bqGraph;
 typedef struct{
unsigned int arcs[16][16];
int vexnum;
}dqGraph;
beiqu();
daohang();




bqchaxun()     /*北区最短路径*/
{
     int k,j,v,u,i,w,v0,g,m,n,p[17][17][17],D[17][17];
        bqGraph G1;
     show_bmp("heart.bmp", 0, 0);
     install_keyboard();
        install_mouse(); /*安装高级鼠标例程*/

   _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/




       set_str_color(_LIGHTGREEN);
       set_str_blank(50);
     set_cn_size(9);


string_out("请选择您所在的地点和您的目的地,",80,40);
string_out("我们将为您提供两地点之间的路径导游服务。",40,70);


string_out("0、西门",140,110);
string_out("1、阶梯教室",140,142);
string_out("2、餐厅",140,174);
string_out("3、宿舍楼",140,206);
string_out("4、教育超市",140,238);
string_out("5、操场",140,270);
string_out("6、运动馆",325,110);
string_out("7、篮球场",325,142);
string_out("8、荷花池",325,174);
string_out("9、礼仪广场",325,206);
string_out("10、正门",325,238);
string_out("11、主楼",325,270);
string_out("请输入您所需查询路径的起点和终点:",80,320);
 readkey();  v0=(int)readkey();
        while (!keypressed());

          readkey();
          g=(int)readkey();while (!keypressed());
                 k=v0;j=g;




set_str_color(_LIGHTCYAN);
set_cn_font(S24X24, "HZK24S");
string_out("返回上一级",20,445);
         while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{
              switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
           {   switch(get_click_info())
             {case 1 : daohang();

             }
           }

       }


        switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=413&&n>=420&&m<=610&&n<=450)
                  { switch(get_click_info())

                          {    case 1:

      beiqu();

                          }


                  }
       }


}
        for(v=0;v<=17;v++)
    for(w=0;w<=17;w++)
     {G1.arcs[v][w]=INFINITY;}

  G1.arcs[0][12]=26;
  G1.arcs[1][11]=18;   G1.arcs[1][12]=25;   G1.arcs[1][13]=28;
  G1.arcs[2][11]=25;   G1.arcs[2][12]=18;   G1.arcs[2][15]=22;
  G1.arcs[3][15]=12;
  G1.arcs[4][5]=22;   G1.arcs[4][6]=14;    G1.arcs[4][15]=37;
  G1.arcs[6][7]=12;
  G1.arcs[7][8]=37;   G1.arcs[7][14]=28;
  G1.arcs[8][11]=22;  G1.arcs[8][15]=25;
  G1.arcs[9][10]=14;  G1.arcs[9][11]=14;
  G1.arcs[10][13]=18; G1.arcs[10][14]=59;

  for(v=0;v<=17;v++)
    for(w=0;w<=17;w++)
      if(G1.arcs[v][w]<INFINITY)
        G1.arcs[w][v]=G1.arcs[v][w];




  for(v=0;v<17;v++)
  for(w=0;w<17;w++)
   {
   D[v][w]=G1.arcs[v][w];
       for(u=0;u<17;u++)
       {p[v][w][u]=0;}
   if(D[v][w]<INFINITY)
       {p[v][w][v]=1;p[v][w][w]=1;
       }
   }






for(u=0;u<17;u++)
  for(v=0;v<17;v++)
    for(w=0;w<17;w++)
      if(D[v][u]+D[u][w]<D[v][w])
        {D[v][w]=D[v][u]+D[u][w];
        for(i=0;i<17;i++)
        {p[v][w][i]=p[v][u][i]||p[u][w][i];

        }}
     printf("%d",k);
         for(u=0;u<16;u++)
   {
            if(p[k][j][u]&&k!=u&&j!=u)
     {
       printf("-->%d",u);
     }
   }
         printf("-->%d",j);

          getch();

     }







/*************************************************************************/

 beiqu()         /*北区图的生成*/
{
 int m,n;
neo_init();
set_video_mode(640,480,16, 75, 0);

             show_bmp("bqzhulou.bmp", 0, 0);




 circlefill(120,140,10,_LIGHTMAGENTA); /*路口1西门餐厅*/
circlefill(120,420,10,_YELLOW); /*路口2阶教下方*/
circlefill(500,420,10,_YELLOW); /*路口3篮球场下方*/
circlefill(330,140,10,_YELLOW); /*路口4宿舍楼下方*/



circlefill(40,140,10,_YELLOW);
  /*西门*/

circlefill(570,140,10,_YELLOW);
  /*操场*/

circlefill(500,140,10,_YELLOW);
 /*教育超市*/
circlefill(500,200,10,_YELLOW);
  /*校医院*/
circlefill(500,250,10,_YELLOW);
   /*运动馆*/

circlefill(120,320,10,_YELLOW);
  /*阶教*/
circlefill(220,320,10,_YELLOW);
/*主楼*/
circlefill(330,320,10,_YELLOW);
 /*荷花池*/
circlefill(330,80,10,_YELLOW);
   /*宿舍楼*/
circlefill(500,320,10,_YELLOW);
  /*篮球场*/

circlefill(220,370,10,_YELLOW);
 /*礼仪广场*/
circlefill(220,420,10,_YELLOW);
  /*正门*/
circlefill(220,140,10,_YELLOW);
   /*餐厅*/

line(50,141,110,141,_YELLOW);
line(231,141,320,141,_YELLOW);
line(511,141,561,141,_YELLOW);
line(130,141,210,141,_YELLOW);
line(340,141,490,141,_YELLOW);

line(130,321,211,321,_YELLOW);
line(230,321,320,321,_YELLOW);
line(340,321,490,321,_YELLOW);

line(500,260,500,310,_YELLOW);
line(500,210,500,240,_YELLOW);
line(500,151,500,190,_YELLOW);

line(121,150,121,310,_YELLOW);
line(220,150,220,310,_YELLOW);
line(220,330,220,360,_YELLOW);
line(220,380,220,410,_YELLOW);
line(331,90,331,130,_YELLOW);
line(331,150,331,310,_YELLOW);



line(130,420,210,420,_YELLOW);
line(120,330,120,410,_YELLOW);
line(230,420,490,420,_YELLOW);
line(500,330,500,410,_YELLOW);
set_str_color(_LIGHTGREEN);
set_str_blank(50);
set_cn_size(9);
string_out("西门",20, 160);

string_out("操场",560, 155);
string_out("教育超市",470, 110);
string_out("校医院",513, 190);
string_out("运动馆",513, 240);
string_out("篮球场",520, 310);
string_out("主楼",233, 300);

string_out("路口",130,150);
string_out("路口",75,410);

string_out("路口",513,410);
string_out("路口",340,150);


string_out("阶梯教室",40, 310);
string_out("荷花池",340, 300);
string_out("宿舍楼", 308, 45);
string_out("礼仪广场",235, 360);
string_out("正门",204, 435);
string_out("餐厅",210, 110);



set_str_color(_YELLOW);
set_cn_font(S24X24, "HZK24S");
string_out("北",55, 45);
string_out("区",120, 45);
set_str_color(_LIGHTCYAN);
set_cn_font(S24X24, "HZK24S");
string_out("返回上一级",20,445);
  while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{



        switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
           {   switch(get_click_info())
             {  case 1 : bqchaxun();

             }
           }

       }
 }
getch();


}

dqchaxun()   /*东区最短路径*/
{
     int k,j,v,u,i,w,v0,g,m,n,p[16][16][16],D[16][16];
     dqGraph G1;
    show_bmp("jing.bmp", 0, 0);
     install_keyboard();
      install_mouse(); /*安装高级鼠标例程*/
          _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
       set_str_color(_LIGHTGREEN);
       set_str_blank(50);
     set_cn_size(9);
        string_out("请选择您所在的地点和您的目的地,",80,40);
        string_out("我们将为您提供两地点之间的路径导游服务。",40,70);
        string_out("0、校门",140,110);
        string_out("1、主楼",140,142);
        string_out("2、宿舍",140,174);
        string_out("3、篮球场",140,206);
        string_out("4、图书馆",140,238);
        string_out("5、餐厅",140,270);
        string_out("6、操场",325,110);
        string_out("7、科技大厦",325,142);
        string_out("8、博士生楼",325,174);
        string_out("9、宿舍楼",325,206);
        string_out("10、礼堂",325,238);
        string_out("请输入您所需查询路径的起点和终点:",80,320);
         readkey();  v0=(int)readkey();
        while (!keypressed());
          readkey();
          g=(int)readkey();while (!keypressed());
                 k=v0;j=g;
         set_str_color(_LIGHTCYAN);
         set_cn_font(S24X24, "HZK24S");
         string_out("返回上一级",20,445);
         while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{
              switch(get_click_info())

      {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
           {           switch(get_click_info())
             {               case 1 : daohang();

             }
           }

       }


                       switch(get_click_info())

      {                      case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=322&&n>=430&&m<=515&&n<=455)
                  {    switch(get_click_info())

                              {    case 1:

                                               dongqu();

                              }


                  }
       }


}                                /*图的初始化*/
         for(v=0;v<16;v++)
         for(w=0;w<16;w++)
         G1.arcs[v][w]=INFINITY;
   G1.arcs[0][1]=26;
  G1.arcs[1][12]=20;
   G1.arcs[1][13]=54;
  G1.arcs[2][3]=36;
    G1.arcs[2][12]=44;
  G1.arcs[3][4]=44;
    G1.arcs[3][16]=20;
  G1.arcs[4][5]=20;
   G1.arcs[4][12]=36;
  G1.arcs[5][9]=72;
   G1.arcs[5][14]=24;
    G1.arcs[5][16]=45;
  G1.arcs[6][14]=46;
   G1.arcs[6][16]=24;
  G1.arcs[7][8]=30;
   G1.arcs[7][11]=40;
     G1.arcs[7][14]=30;
  G1.arcs[8][15]=30;
  G1.arcs[9][10]=42;
  G1.arcs[9][11]=24;
  G1.arcs[10][13]=18;
  G1.arcs[14][15]=30;

  for(v=0;v<16;v++)

     for(w=0;w<16;w++)

        if(G1.arcs[v][w]<INFINITY)
           G1.arcs[w][v]=G1.arcs[v][w];




  for(v=0;v<16;v++)
     for(w=0;w<16;w++)
        {
             D[v][w]=G1.arcs[v][w];
               for(u=0;u<16;u++)
                  {  p[v][w][u]=0;}
               if(D[v][w]<INFINITY)
                {    p[v][w][v]=1;p[v][w][w]=1;
                 }
        }


for(u=0;u<16;u++)
  for(v=0;v<16;v++)
    for(w=0;w<16;w++)
      if(D[v][u]+D[u][w]<D[v][w])
        {             D[v][w]=D[v][u]+D[u][w];
                          for(i=0;i<16;i++)
                              {     p[v][w][i]=p[v][u][i]||p[u][w][i];

                               }
        }
     printf("%d",k);
         for(u=0;u<16;u++)
   {
            if(p[k][j][u]&&k!=u&&j!=u)
     {
       printf("-->%d",u);
     }
   }
         printf("-->%d",j);

          getch();

}


 dongqu()     /*东区图*/
{
 int m,n;
neo_init();
set_video_mode(640,480,16, 75, 0);
  show_bmp("jin-qiu.bmp", 0, 0);
  circlefill(150,110,10,_LIGHTMAGENTA);
   circlefill(150,220,10,_LIGHTMAGENTA);
     circlefill(150,310,10,_LIGHTMAGENTA);
      circlefill(240,175,10,_LIGHTMAGENTA);
       circlefill(240,220,10,_LIGHTMAGENTA);
        circlefill(330,310,10,_LIGHTMAGENTA);
         circlefill(330,380,10,_LIGHTMAGENTA);
          circlefill(490,265,10,_LIGHTMAGENTA);
           circlefill(490,175,10,_LIGHTMAGENTA);
            circlefill(295,110,10,_LIGHTMAGENTA);
             circlefill(295,50,10,_LIGHTMAGENTA);
               circlefill(490,110,10,_LIGHTMAGENTA); /*路口1宿舍楼那里*/
                circlefill(240,310,10,_LIGHTMAGENTA);  /*路口2主楼图书馆那里*/
                 circlefill(490,310,10,_LIGHTMAGENTA);  /*路口3礼堂那里*/
                   circlefill(240,110,10,_LIGHTMAGENTA);  /*路口4科技大厦*/
                     circlefill(240,50,10,_LIGHTMAGENTA);   /*路口5博士生楼那里*/
                      circlefill(150,175,10,_LIGHTMAGENTA);  /*操场和篮球场之间*/
 set_str_color(_LIGHTGREEN);
  set_str_blank(50);
   set_cn_size(9);
    string_out("校门",315, 397);
     string_out("篮球场",90, 215);
      string_out("宿舍",105, 300);
        string_out("餐厅",250, 155);
          string_out("图书馆",255, 210);
            string_out("主楼",313, 282);
             string_out("礼堂",503, 260);
              string_out("路口",504,100);
                string_out("路口",225,323);
                 string_out("路口",504,305);
                  string_out("路口",195,90);
                   string_out("路口",195,43);
                    string_out("路口",100,170);
                     string_out("路口",100,170);
                      string_out("操场",100, 100);
                       string_out("宿舍楼",500, 165);
                         string_out("科技大厦",280, 123);
                          string_out("博士生楼",310, 43);
 set_str_color(_YELLOW);
set_cn_font(S24X24, "HZK24S");
string_out("东",590, 73);
string_out("区",590, 173);
line(160,176,230,176,_LIGHTMAGENTA);
line(151,229,151,300,_LIGHTMAGENTA);
line(151,119,151,165,_LIGHTMAGENTA);
line(151,185,151,210,_LIGHTMAGENTA);
line(240,60,240,100,_LIGHTMAGENTA);
line(240,120,240,165,_LIGHTMAGENTA);
line(250,53,287,53,_LIGHTMAGENTA);
line(159,311,230,311,_LIGHTMAGENTA);
line(250,311,320,311,_LIGHTMAGENTA);
line(329,320,329,372,_LIGHTMAGENTA);
line(240,230,240,300,_LIGHTMAGENTA);
line(240,185,240,210,_LIGHTMAGENTA);
line(250,175,480,175,_LIGHTMAGENTA);
line(160,111,230,111,_LIGHTMAGENTA);
line(250,111,285,111,_LIGHTMAGENTA);
line(295,60,295,100,_LIGHTMAGENTA);
line(305,111,480,111,_LIGHTMAGENTA);
line(490,122,490,165,_LIGHTMAGENTA);
line(490,185,490,255,_LIGHTMAGENTA);
line(340,312,480,312,_LIGHTMAGENTA);
line(490,277,490,300,_LIGHTMAGENTA);
line(160,220,230,220,_LIGHTMAGENTA);
set_str_color(_LIGHTCYAN);
set_cn_font(S24X24, "HZK24S");
string_out("返回上一级",20,445);
  while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{      switch(get_click_info())

             {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                     if(m>=20&&n>=440&&m<=104&&n<=465)/*用户选择返回上一级*/
                       {     switch(get_click_info())
                                  {   case 1 : dqchaxun();

                                   }
                        }

             }
 }
getch();
}
dqintro()      /*东区介绍*/
{        int m,n;
       show_bmp("dzhulou.bmp", 0, 0);

      install_mouse(); /*安装高级鼠标例程*/
     _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
     while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
     {            switch(get_click_info())
                  {        case 1:   m=get_mouse_x();
                        n=get_mouse_y();
                  if(m>=400&&n>=380&&m<=580&&n<=430)/*用户选择返回上一级*/
           {        switch(get_click_info())
                          {       case 1 :daohang();

                           }
           }
                   }
     } getch();
}
bqintro()       /*北区介绍*/
{     int m,n;
      show_bmp("bjieshao.bmp", 0, 0);
      install_mouse(); /*安装高级鼠标例程*/
      _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
      while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
      {      switch(get_click_info())
                 {    case 1:
                        m=get_mouse_x();
                        n=get_mouse_y();
                       if(m>=185&&n>=403&&m<=428&&n<=455)
                              /*用户选择返回上一级*/
                         {    switch(get_click_info())
                                    {     case 1 : daohang();
                                     }
                         }
                 }
     } getch();
}
intro()        /*介绍*/
{    int z,w;
      show_bmp("jieshao.bmp", 0, 0);
       install_mouse(); /*安装高级鼠标例程*/
         _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
      while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
   {      switch(get_click_info())
                {    case 1:
                           z=get_mouse_x();
                           w=get_mouse_y();
                if(z>=205&&w>=361&&z<=445&&w<=420) /*返回上一级*/
                  {    switch(get_click_info())
                     {case 1:mouse();
                     }
                   }
                 }
    }       getch();
}

huanying()   /*最开始的欢迎界面*/
{  show_bmp("tupian.bmp", 0, 0);
     install_mouse(); /*安装高级鼠标例程*/

   _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/

}
daohang()     /*学校红墙图片,导航界面*/
{    int z,w;
      show_bmp("qiang.bmp", 0, 0);
        install_mouse(); /*安装高级鼠标例程*/
         _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
             while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{                switch(get_click_info())

                      {    case 1:
                                       z=get_mouse_x();
                                      w=get_mouse_y();
                         if(z>=40&&w>=120&&z<=180&&w<=145)/*东区景点介绍*/
                           {
                                       switch(get_click_info())

                                      {     case 1:
                                            dqintro();
                                      }
                           }
                        if(z>=460&&w>=120&&z<=610&&w<=145)/*东区最佳路线*/
                           {      switch(get_click_info())
                                  {case 1:
                                 dqchaxun();
                                  }
                           }
                       if(z>=40&&w>=230&&z<=180&&w<=260)/*北区景点介绍*/

                            {            switch(get_click_info())
                                 {case 1:  bqintro();
                                  }

                             }


                        if(z>=460&&w>=230&&z<=610&&w<=260)/*北区最佳路线*/
                         {          switch(get_click_info())
                                  {   case 1:
                                      bqchaxun();
                                  }
                          }
                       if(z>=20&&w>=380&&z<=245&&w<=433)/*返回主界面*/

                        {    switch(get_click_info())

                                   {case 1:

                                  mouse();

                                   }

                         }
     }}
}
help()             /*阶教图片,帮助*/
{      int z,w;
   show_bmp("help.bmp", 0, 0);
                      install_mouse(); /*安装高级鼠标例程*/

   _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
                while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
           {      switch(get_click_info())
                          {    case 1:
                                z=get_mouse_x();
                                w=get_mouse_y();
                if(z>=205&&w>=345&&z<=448&&w<=400) /*tu4中的返回主界面*/
                {    switch(get_click_info())
                            {       case 1:
                                          mouse ();
                            }

                 }
                          }
           }             getch();

}


mouse()           /*整个鼠标全局的操作*/
{  int x,y;
    neo_init();
  set_video_mode(640,480,16, 75, 0); /*进入640X480,16位图形模式*/
  huanying();

     while((get_click_info() != 5) && !kbhit()) /*左键双击或按任意键退出*/
{          switch(get_click_info())
                                 
      {    case 1:

                 x=get_mouse_x();
                 y=get_mouse_y();
              if(x>=240&&y>=225&&x<=403&&y<=258)/*进入导航页面*/
           {         switch(get_click_info())

                       {case 1:     daohang();

                        }


            }

             /*以下为帮助算法*/
                 if(x>=240&&y>260&&x<=403&&y<=289)/*主界面帮助键*/
           {
                  switch(get_click_info())
                          {   case 1:
                                     help();

                           }

           }

/******************************以下北化介绍*************************************/
                if(x>=240&&y>290&&x<=403&&y<=318)
                {         switch(get_click_info())
                               {           case 1:  intro();
                               }
                  }
 /***************************************************************************/
               /*主界面的退出*/
                     if(x>=240&&y>320&&x<=403&&y<=350)
     {         switch(get_click_info())
              {   case 1:

               show_bmp("bye.bmp", 0, 0);
              install_mouse(); /*安装高级鼠标例程*/

             _install_timer(); /*加载时钟例程,它绑定了鼠标状态刷新函数*/
              getch();
              }

     }
   } /*最初的switch*/

 }  /*while*/


}/*mouse*/

main()/*主函数中最后添加了音频文件,就一句话:“Mission accomplished!"*/
{  
   SAMPLE *wav;
      neo_init();  mouse();
   install_keyboard();
   install_sound();  /*安装音频例程*/
   wav = load_wav("win.wav"); /*读入一个音频采样*/

   play_sample_ex(wav, 0,0,0,0);   /*单次播放音频采样*/
   readkey();
   stop_sample(wav); /*中止音频采样*/

    return;
 }
2008-02-18 15:47
jig
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
帖 子:530
专家分:242
注 册:2005-12-27
收藏
得分:0 
不错

个人网站 -  http://.h001.
2008-02-18 16:24
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 
一般来说程序中有一个neo_init();和一个set_video_mode(640,480,16, 75, 0);就可以了,除非你要在运行中改变分辨率,你可以在main()函数开头加上这两个函数,然后其它的地方就可以不用了。
2008-02-18 17:20
pt20021403
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-2-19
收藏
得分:0 
我们公司的规定有一条警告就扣一百块,资本家就是黑啊
2008-02-19 12:31
kaitlynyl
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-2-16
收藏
得分:0 
可是最短路径的问题还没有解决呢~为什么最短路径显示不了?我刚开始用的迪杰斯特拉,后来用了弗洛伊德了,好像都不行
2008-02-19 17:34
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 
你再查查你的程序,里面有内存问题,某些地方你的指针肯定用错了,导致程序结束时系统会显示空指针赋值。
2008-02-20 14:06
快速回复:我的数构课设——最短路径(有问题:最短路径显示不了)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.191102 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved