调试没有通过,有空者帮我解解惑!(等待中)
#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




