CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

调试没有通过,有空者帮我解解惑!(等待中)

楼主foxmishy()2005-04-01 20:54:00 在 VC/MFC / 基础类 提问

 
  #include   <string.h>  
  #include   <iostream.h>  
  #include   <stdlib.h>  
  #include   <stdio.h>  
  #include   <iomanip.h>  
  #include   "display.h"  
   
   
   
   
  main()  
  {    
        KDisplay   obj;  
        long   int   filelen;  
        int   row   =   0;//用于累计多少行  
        char   *buffer;//用来暂时存放文件信息  
        char   *pchar;   //临时指针  
        char   *temp;//临时指针  
        int   paraMark;  
        cin   >>   paraMark   ;  
        FILE   *fp;  
        filelen   =   FileLen(   "e:\1.ksc"   );  
        if(   (fp   =   fopen(   "e:\1.ksc",   "r"   ))   ==   NULL   )  
        {  
                  cout   <<   "open   the   file   failed!"   <<   endl;  
                  cout   <<   "please   input   the   file   with   the   postfix   is   .ksc"   <<   endl;  
  exit(0);  
        }  
   
          buffer   =   new   char[filelen];  
          if(   fgets(   buffer,   FileLen,   fp   )   !=   NULL   )  
  {  
  if(   *buffer   =   ';'   )  
  {  
              row++;  
              buffer++;  
  }  
  }  
           
          if(   paraMark   =   '0'   )   //第一段  
          {  
                obj.LyricSty();  
                cout   <<   setw(4)   <<   paraMark;    
                cout   <<   setw(6)   <<   obj.UnderwJudgeLoc();  
                cout   <<   setw(12)   <<   obj.DisplayT(fp);  
                cout   <<   setw(16)   <<   obj.StartSingT(fp);  
                temp   =   obj.GetString(fp);  
                obj.T1(fp);  
                for(int   i=0;   i<row;   i++)//行循环  
        {  
            if(   pchar   =   strchr(   temp,   ';'   )   )  
    {  
                        cout   <<   endl;  
                        cout   <<   setw(16)   <<   obj.StartSingT(fp);  
                        obj.GetString(fp);  
                        obj.T1(fp);  
    }  
        }  
   
          }  
              else   if(paraMark   =   '1')//第二段落  
              {  
                    cout   <<   setw(4)   <<   paraMark;    
                    cout   <<   setw(6)   <<   obj.UnderwJudgeLoc();  
                    cout   <<   setw(12)   <<   obj.DisplayT(fp);  
                    cout   <<   setw(16)   <<   obj.StartSingT(fp);  
                    obj.GetString(fp);  
                    obj.T1(fp);  
   
              }    
   
                       
                fclose(fp);  
                 
      return   0   ;  
  }  
   
   
   
  #include   <iostream.h>  
  #include   <stdio.h>  
  #include   <string.h>  
  #include   <stdlib.h>  
  #include   "display.h"  
  #include   <iomanip.h>  
  #include   <ctype.h>  
   
   
  char*   KDisplay::GetString(   FILE   *fp   )//把文件中获取的字符串做相应的处理得到需要的字符串(去掉冗余)  
  {  
              char   *ptem;  
      char   *str;  
              char   stbuf[   8   ];//starttime;  
              char   edbuf[   8   ];//endtime;  
              char   rowbuf[   20   ];//rowchar;  
              char   charbuf[   4   ];//a   word   to   the   second   word   time;  
                         
   
   
   
                         
                           
  if(   !(ptem   =strstr(   buffer,   "("   )   )   )    
        {  
                    ptem   =   strtok(   buffer,   "("   );  
                    ptem   =   strtok(   ptem,   "   '''   ");      
     
                    if(   *ptem   ==   '0'   )  
    {  
                            ptem   =   strtok(   ptem,   "   0   "   );  
                    ptem   =   strtok(   ptem,   "   :   ");                  
                    ptem   =   strtok(   ptem,   "   .   ");  
                          if(   str   =   strstr(   ptem,   ","   )   )  
  {    
                                strcpy(   stbuf,   str   );  
                                ptem   =   ptem   +   strlen(   stbuf   );  
  }  
  else  
  {  
  strcpy(   edbuf,   ptem   );  
                                  ptem   =   ptem   +   strlen(   edbuf   );  
  }  
    }  
         
      else   if   (   !strstr(   buffer,   "["   )   )  
      {  
            if(   ptem   =   strtok(   buffer,   "["   )   )  
  {                                          
            ptem   =   strtok(   ptem,   "]");  
    str   =   strstr(   ptem,   "   ,   ");  
              if   (   isalpha(*(str+1)   ))    
      {  
                    strcpy(   rowbuf,   str   );  
    ptem   =   ptem   +   strlen(   rowbuf   );  
    int   temp;  
    temp   =   strlen(   rowbuf   );  
                    cout   <<   setw(19)   <<   temp;  
                    cout   <<   setw(39)   <<   rowbuf   <<   endl;//输出获取的字符串  
    for(int   n=0;   n<temp;   n++)  
    {  
                                                    if(   str   =   strstr(   ptem,   ","   )   );  
  {  
                                          strcpy(   charbuf   ptem   );  
                                          ptem   =   ptem   +   strlen(   charbuf   );  
  }                            
    }          
      }  
                    }    
      }  
     
   
    return   ptem;  
    }  
   
   
   
  int   KDisplay::StringToInt(   char   *temp   )//字符串转为整型数据  
  {  
        for(int   i=7;   i>=0;   i--)      
        {          
            temp   =   temp*10   +   tbuf[i]   -   '0';  
        }  
        return   temp;  
  }  
   
     
  int   KDisplay::OctToHex(int   *temp   )   //十进制转十六进制        
  {  
              temp   =   temp/16;  
              temp'   =   temp%16;  
              if(   temp'>9   )  
              {  
                  if(   temp'=   10   )temp'   =   A;  
                  else   if(   temp'   =   11   )temp'   =   B;  
                  else   if(   temp'   =   12   )temp'   =   C;  
                  else   if(   temp'   =   13   )temp'   =   D;  
                  else   if(   temp'   =   14   )temp'   =   E;  
                  else   if(   temp'   =   15   )temp'   =   F;  
                  temp   =   10*temp   +   temp'   ;  
                }  
                cout   <<   temp   <<   endl;  
          }  
          return   temp;  
    }  
     
     
         
  int   KDisplay::StartSingT(   FILE   *fp   )//起唱时间  
  {  
  int   temp;  
          temp   =   StringToInt(   GetString(fp)   );  
          return(   OctToHex(   temp   )   );  
  }  
   
   
   
  int   KDisplay::DisplayT(   FILE*   fp   )//显示时间  
  {  
  int   temp;  
          temp   =   StringToInt(   GetString(fp)   );  
  temp   =   temp   -   4000;  
          if(   temp   <   0   )    
  return(   4000   -   temp   );  
  else  
  return(   temp   -   4000   );  
  }  
   
  char   KDisplay::UnderwJudgeLoc()//起步判断位  
  {  
  if(   DisplayT(fp)   <=   0   )    
  return(   '0'   );  
  else  
  return(   '1'   );  
  }  
   
   
  int   KDisplay::T2(   FILE   *fp   )//中文歌词  
  {  
  int   temT;  
  int   temT1;  
  int   wordLen   =   2;  
  int   temp;  
          temT   =   StringToInt(   GetString(fp)   );  
  temp   =   temT;  
          temp1   =     temT/wordLen;  
  temT   =   (int)(temT1/24);  
  T2   =   temp   -   temT*23;  
  cout   <<   setw(41)   <<   temT   <<   endl;  
  cout   <<   setw(43)   <<   T2   <<   endl;  
  return(   T1   );  
  }  
   
   
  int   KDisplay::T1(   FILE   *fp   )//英文歌词  
  {  
  int   temT;  
  int   temT1;  
  int   wordLen;  
  int   temp;  
          temT   =   StringToInt(   GetString(fp)   );  
  temp   =   temT;  
  else   if   (!strstr(buffer,   "["))   continue;  
        while(   strtok(   ,   "["   )   )  
        {                            
          if   (   strstr(   ptem,   "]"   )  
          {  
                    strcpy(   rowbuf,   ptem   );  
    wordLen   =   strlen(   rowbuf   );  
            }  
                    }  
        temT1   =     temT/wordLen;  
        temT   =   (int)(temT1/24);  
        T2   =   temp   -   temT*23;  
                        cout   <<   set(41)   <<   temT   <<   endl;  
                        cout   <<   set(43)   <<   T2   <<   endl;  
        return(   T1   );  
  }  
   
   
  void   KDisplay::LyricSty()//歌词类型(中文)或(西文)  
  {  
            if(   isalpha(   *GetString(FILE   *fp)   )   )  
            cout   <<   '   '   <<   '3';  
             
            else    
            cout   <<   '   '   <<   '2';  
  }  
   
   
  class   KDisplay{  
   
  public   :  
                              KDisplay(){};  
                      virtual   ~KDisplay(){};  
                        char*   GetString(   FILE   *fp   );  
      int   StringToInt(   char   *temp   );  
      int   OctToHex(int   *temp   );  
      int   StartSingT(   FILE   *fp   );  
      int   DisplayT(   FILE   *fp);  
      char   UnderwJudgeLoc();  
      int   T2(   FILE   *fp   );  
      int   T1(   FILE   *fp   );  
      void   LyricSty();  
  }  
   
  多谢提点!  
  问题点数:0、回复次数:4Top

1 楼foxmishy()回复于 2005-04-01 21:11:43 得分 0

f:\tt\display\display\main.cpp(12)   :   error   C2143:   syntax   error   :   missing   ';'   before   'PCH   creation   point'  
  f:\tt\display\display\main.cpp(23)   :   error   C2065:   'FileLen'   :   undeclared   identifier  
   
  这样   的错误是什么意思那?Top

2 楼foxmishy()回复于 2005-04-01 21:13:08 得分 0

display.cpp  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(130)   :   error   C2236:   unexpected   'class'   '__SMANIP_int'  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(130)   :   error   C2143:   syntax   error   :   missing   ';'   before   '{'  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(130)   :   error   C2447:   missing   function   header   (old-style   formal   list?)  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(130)   :   error   C2143:   syntax   error   :   missing   ';'   before   '('  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(130)   :   error   C2501:   '__SMANIP_int'   :   missing   storage-class   or   type   specifiers  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(141)   :   error   C2146:   syntax   error   :   missing   ';'   before   identifier   'setfill'  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(141)   :   error   C2433:   '__SMANIP_int'   :   'inline'   not   permitted   on   data   declarations  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(141)   :   error   C2501:   '__SMANIP_int'   :   missing   storage-class   or   type   specifiers  
  d:\microsoft   visual   studio\vc98\include\iomanip.h(141)   :   fatal   error   C1004:   unexpected   end   of   file   found  
  Error   executing   cl.exe.  
   
  display.obj   -   9   error(s),   0   warning(s)Top

3 楼foxmishy()回复于 2005-04-01 21:21:36 得分 0

#include   <iomanip.h>     ?去掉嘞还有两错误。怎么回事?Top

4 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2005-04-01 21:57:21 得分 0

头文件是否正确包含Top

相关问题

  • 通过DEBUG调试通过的程序,为什么还不可以?
  • 文件名问题, 调试通过立即给分
  • 讨论以下存储过程为什么调试不通过?????????
  • 由谁能调试这个程序??? 通过即给分,急!!!!!!!
  • 开发环境---决不吝啬,调试通过现场给分!
  • 检测鼠标的程序,调试通过但答案错
  • 小问题,调试通过马上结帖
  • 类似的问题,调试通过就结贴
  • eclipse+myeclipse+tomcat调试不通过,急死了,SOS
  • 逐语句调试出错,但编译时通过

关键词

  • ptem
  • rowbuf
  • strtok
  • edbuf
  • stbuf
  • strstr
  • filelen
  • strlen
  • strcpy
  • fp

得分解答快速导航

  • 帖主:foxmishy

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo