| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 761 人关注过本帖
标题:[求助] 不知道是程序问题还是软件问题!
只看楼主 加入收藏
blackkey
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2005-6-8
收藏
 问题点数:0 回复次数:10 
[求助] 不知道是程序问题还是软件问题!

我用C - FREE 3。5 写C程序~

但是经常出现一写 莫名其妙的问题~

如 : 我写了一段程序!

pw_stmp = "123456" ;
mn_stmp = "88888880000001" ;
int i_yz ; // 显示这行错误!!不知道为什么 我声明一个INT型的变量也错!

编译 的时候 指出我 第三行 错误~ 错误信息:parse error before 'int'

搜索更多相关主题的帖子: 软件 
2006-07-03 14:08
blackkey
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2005-6-8
收藏
得分:0 

高手指点以下


2006-07-03 14:09
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 
全部代码

[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-07-03 14:12
blackkey
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2005-6-8
收藏
得分:0 

#include <string.h>
#include <stdio.h>


char * substring(char *str1,char *str2,int a,int b);
char * stryz(char *bjvalue , char *stmp) ;
char * answer( char *answer_st , char *answer_cn , char *answer_pw , char *answer_mn ,char *answer_Flag , char *answer_qn , char *answer_cp) ;
char *send( char *send_st , char *send_cn , char *send_pw , char *send_mn , char *send_cp ) ;
int main( )
{
char s[110]="QN=20040516010101001;ST=32;CN=1072;PW=123456;MN=88888880000001;Flag=3;CP=&&PW=654321123456&&";
char *p=s;
char *s1=s;
char *v1 ;
char *pw_stmp ;
char *mn_stmp ;
char *stmp ;
char qn[18] ;
char st[6] ;
char cn[6] ;
char pw[20] ;
char mn[18] ;
char *mn1;
char Flag[3] ;
char cp[20] ;
char pw_set[10] ;
int isp ;
int iep ;
char answer_qq[90] ;
char send_temp[100] ;
isp = 0 ;

/*==========检测数据包的完整性==========*/

if ((strchr(s,'Q')-s) < 0 || (strchr(s,'N')-s) < 0 || (strchr(s,'S')-s) < 0 || (strchr(s,'T')-s) < 0
||(strchr(s,'C')-s) < 0 || (strchr(s,'P')-s) < 0 || (strchr(s,'W')-s) < 0 || (strchr(s,'M')-s) < 0
|| (strchr(s,'P')-s) < 0 || (strchr(s,'&')-s) < 0 )
{
printf("异常:%s\n","数据包格式错误!!程序不做处理!!") ;
}
else
{
printf("正常:%s\n","数据包格式正常") ;
}

/*******取QN***************/
p=strchr(s,'=') ;
isp = p-s ;
p++;
p=strchr(p,';') ;
iep = p-s ;
substring(v1,s1,isp+2,iep-(isp+1)) ; //这里调用函数:FUN
strcpy(qn, v1);
printf("QN:%s\n",qn);
/********取ST************/
p = strchr(p,'=') ;
isp = p-s ;
p = strchr(p,';') ;
iep = p-s ;
substring(v1,s1,isp+2,iep-(isp+1));
strcpy(st, v1);
printf("ST:%s\n",st) ;
/********取CN************/
p = strchr(p,'=') ;
isp = p-s ;
p = strchr(p,';') ;
iep = p-s ;
substring(v1,s1,isp+2,iep-(isp+1));
strcpy(cn, v1);
printf("CN:%s\n",cn) ;
/********取PW************/
p = strchr(p,'=') ;
isp = p-s ;
p = strchr(p,';') ;
iep = p-s ;
substring(v1,s1,isp+2,iep-(isp+1));
strcpy(pw, v1);
printf("PW:%s\n",pw) ;
/********取MN************/
p = strchr(p,'=') ;
isp = p-s ;
p = strchr(p,';') ;
iep = p-s ;
substring(v1,s1,isp+2,iep-(isp+1));
strcpy(mn, v1);
printf("MN:%s\n",mn) ;
/********取Flag************/
p = strchr(p,'=') ;
isp = p-s ;
p = strchr(p,';') ;
iep = p-s ;
substring(v1,s1,isp+2,iep-(isp+1));
strcpy(Flag, v1);
/********取CP************/
p = strchr(p,'&') ;
isp = p-s ;
p = p+2 ;
p = strchr(p,'&') ;
iep = p-s ;
substring(v1,s1,isp+3,iep-(isp+2));
strcpy(cp, v1);
printf("CP:%s\n",cp) ;


/*- - - - - - 验 证 密 码 和 设 备 ID - - - - - - - - - - - - - - - - - - */
pw_stmp = "123456" ;
mn_stmp = "88888880000001" ;
int set_yz ; 这里出错!!
// i_yz = strcmp(pw_stmp,"123456") ;

}

/*------------------------------------------------------------------------------*/
/* */
/* /*函数区域*/
/* */
/*------------------------------------------------------------------------------*/

/******************函数(substring)******************************/
char * substring(char *str1,char *str2,int a,int b)
{
char *ptr1=str1;
long i ;
for(i=a;i<a+b;i++)
{
*ptr1=*(str2+i-1);
ptr1++ ;
}
*ptr1=0;
return str1;
}

/******************函数(stryz)******************************/

char * stryz(char *bjvalue , char *stmp)
{
int n = strcmp(bjvalue,stmp) ;
if( n != 0 )
{
printf("消息:%s\n","密码或者设备ID错误") ;
return "1" ;
}
else
{
printf("消息:%s\n","密码及设备ID正确") ;
return 0 ;
}

}
/******************函数(answer)******************************/
/*-------------------------*/
/*请求应答函数 */
/*------------------------*/
char * answer( char *answer_st , char *answer_cn , char *answer_pw , char *answer_mn ,char *answer_Flag , char *answer_qn , char *answer_cp)
{
char *answer_str ;
char answer_stmp[90] ;
strcpy(answer_stmp, "ST=");
strcat(answer_stmp,answer_st) ;
strcat(answer_stmp,";") ;
strcat(answer_stmp,"CN=") ;
strcat(answer_stmp,answer_cn) ;
strcat(answer_stmp,";") ;
strcat(answer_stmp,"PW=") ;
strcat(answer_stmp,answer_pw) ;
strcat(answer_stmp,";") ;
strcat(answer_stmp,"MN=") ;
strcat(answer_stmp,answer_mn) ;
strcat(answer_stmp,";") ;
strcat(answer_stmp,"Flag=") ;
strcat(answer_stmp,answer_Flag) ;
strcat(answer_stmp,";") ;
strcat(answer_stmp,"CP=&&QN=") ;
strcat(answer_stmp,answer_qn) ;
strcat(answer_stmp,";") ;
strcat(answer_stmp,answer_cp) ;
strcat(answer_stmp,"&&") ;
answer_str = answer_stmp ;
return answer_str ;
}
/*****************************函数(send)***************************************************/
char *send( char *send_st , char *send_cn , char *send_pw , char *send_mn , char *send_cp )
{
char *send_str ;
char send_stmp[90] ;
strcpy( send_stmp , "ST=" ) ;
strcat( send_stmp , send_st ) ;
strcat( send_stmp , ";" ) ;
strcat( send_stmp , "CN=" ) ;
strcat( send_stmp , send_cn ) ;
strcat( send_stmp , ";" ) ;
strcat( send_stmp , "PW=" ) ;
strcat( send_stmp , send_pw ) ;
strcat( send_stmp , ";" ) ;
strcat( send_stmp , "MN=" ) ;
strcat( send_stmp , send_mn ) ;
strcat( send_stmp , ";" ) ;
strcat( send_stmp , "CP=&&" ) ;
strcat( send_stmp , send_cp ) ;
strcat( send_stmp , "&&" ) ;
send_str = send_stmp ;
return send_str ;

}


2006-07-03 14:17
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 
C-FREE 没错误!

[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-07-03 14:20
blackkey
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2005-6-8
收藏
得分:0 
你的C - FREE 没错误吗??

2006-07-03 14:24
blackkey
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2005-6-8
收藏
得分:0 
为什么我的有错误??

2006-07-03 14:25
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 
后缀 .cpp

用C++文件存储!

[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-07-03 14:25
blackkey
Rank: 1
等 级:新手上路
帖 子:159
专家分:0
注 册:2005-6-8
收藏
得分:0 
你有C-FREE的注册机吗?

2006-07-03 14:25
SunShining
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:31
帖 子:2215
专家分:0
注 册:2006-2-17
收藏
得分:0 

[CODE]#include "stdlib.h"
#include "stdio.h"

int main(int argc, char* argv[])
{
char chKey[128] = {0};
unsigned int unXORCode, unRemainder, unQuotient, unTmp, unMachineCode;
printf("Please Key in the Machine Code:\n");
scanf("%d", &unMachineCode);
unXORCode = unMachineCode ^ 0x90909090;
unRemainder = unXORCode % 0x25;
unQuotient = unXORCode;
if (unRemainder < 0x11)
{
unRemainder += 0x11;
}
int i;
i = 0;
while (unQuotient != 0)
{
unTmp = unQuotient % unRemainder;
unQuotient /= unRemainder;
if (unTmp >= 0xa)
{
unTmp = unTmp + 0x61 + 0xf6;
unTmp &= 0x0ff;
chKey[i] = unTmp;
}
else
{
chKey[i] = unTmp + 0x30;
}
i++;
}
printf("Key is: \n");
while (i >= 0)
{
printf("%c", chKey[i]);
i--;
}
printf("\n");
return 0;
}[/CODE]

老K刨开的吧


[glow=255,violet,2]闭关修炼ing...[/glow] [FLASH=360,180]http://www./chinaren.swf[/FLASH]
2006-07-03 14:28
快速回复:[求助] 不知道是程序问题还是软件问题!
数据加载中...
 
   



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

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