刚刚学习
找了几个程序
掺在一起,问题多多
请各位高人指点指点
#include<graphics.h>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
# include "math.h"
void panduan(void);
void ze(void);
void ze1(void);
void run(void);
void jilu(void);
int t;
unsigned long s,a,b,x,o;
main()
{
srand(time(0));
a=rand();
b=20061219;
float num[7]; // <-------这里咋搞??
FILE *fp;
fp=fopen("string","rb");
for(t=0;t<=6;t=t+1)
fread(&num[t],sizeof(int),1,fp);
if (num[5]==null)
{
printf("Please input key:");
scanf("%lu",&b);
num[0]=a;
num[1]=b;
num[6]=302;
num[5]=a*b+a-b*234586;
printf("You key is: %lu.",&num[5]);
}
void panduan(void);
{
if (num[2]=(b*94345321+54434534663-num[5]*734556))
ze1();
if (num[3]=(num[2]+3893455+b*78345332314+num[5]*5233453325))
ze();
if (num[4]=(num[2]+7234594*b-num[3]+4565+num[5]*754345564-num[3]*3345423+num[2]*23452))
run();
}
for(t=0;t<=6;t=t+1)
printf("num=%f \n",num[t]);
}
//*********网上抄的汉字显示程序***********//
void hanzi(int x,int y,char *s,int colour) /* x,y为汉字坐标,s为字符串,colour为颜色值*/
{
FILE *fp;
char buffer[32];
register i,j,k;
unsigned char qh,wh; /*区位码*/
unsigned long location; /*汉字在字库中的位置*/
if((fp=fopen("hzk16","rb"))==NULL)
{
printf("Can't open hzk16!");
getch();
exit(0);
}
while(*s)
{
qh=*s-0xa0;
wh=*(s+1)-0xa0;
location=(94*(qh-1)+(wh-1))*32L;
fseek(fp,location,SEEK_SET);
fread(buffer,32,1,fp);
for (i=0;i<16;i++)
for(j=0;j<2;j++)
for(k=0;k<8;k++)
if(((buffer[i*2+j]>>(7-k))&0x1)!=NULL)
putpixel(x+8*j+k,y+i,colour);
s+=2;
x+=16; /*汉字间距*/
}
fclose(fp);
}
void ze(void)
{
int graphdriver=VGA;
int graphmode=VGAHI;
initgraph(&graphdriver,&graphmode,"");
hanzi(110,110,"测试程序,观看结果专用。",2);
hanzi(110,150,"山东省人啊 请多指教。",2);
hanzi(110,200,"电话:123456789",2);
getch();
closegraph();
fclose(fp);
jilu();
}
void ze1(void)
{
int graphdriver=VGA;
int graphmode=VGAHI;
initgraph(&graphdriver,&graphmode,"");
hanzi(110,110,"测试程序,观看结果专用。",2);
hanzi(110,150,"测试成功了一半了。",2);
hanzi(110,200,"你真聪明啊",2);
getch();
closegraph();
fclose(fp);
jilu();
}
void jilu(void)
{
fp=fopen("string","rb");
for(t=0;t<=6;t=t+1)
fwrite(&num[i],sizeof(float),1,fp);
fclose(fp);
run();
}
void run(void)
{
system("1.EXE");
system("2.EXE /h");
system("3.EXE");
clrscr();
}
[此贴子已经被作者于2006-12-19 17:23:15编辑过]
----------------解决方案--------------------------------------------------------
想作个简单的加密程序而已
我得设想:
记录文件
0 1 2 3 4
随机数 密匙(自设) 密码a(限制次数) 密码b(限制次数) 密码c(无限制)
5 6
sn 次数
请高手指点
怎么实现???
----------------解决方案--------------------------------------------------------
int t;就提示错误
怎么回事???
还有数组问题!
帮帮忙了
----------------解决方案--------------------------------------------------------
zhidian
----------------解决方案--------------------------------------------------------
我都服了,sum[]是浮点型数组,,a,b是无符号长整型,,能赋值吗?
float num[7]; // <-------这里咋搞??
FILE *fp;
fp=fopen("string","rb");
for(t=0;t<=6;t=t+1)
fread(&num[t],sizeof(int),1,fp);
if (num[5]==null) //小写系统也不认识啊~!
{
printf("Please input key:");
scanf("%lu",&b);
num[0]=a;
num[1]=b; // 你换一种写法,,把a,b 定义成指针试试
num[6]=302;
num[5]=a*b+a-b*234586
----------------解决方案--------------------------------------------------------