请教一下,现想实现一个功能,某个VB6开发的程序在操作人员不使用时,可以临时锁定这个程序,用时再输入登录密码解锁,这样这个程序中已打开的几个窗口不用关闭。 [问题点数:50分,结帖人eisldkw]

Bbs1
本版专家分:0
结帖率 98.82%
Bbs7
本版专家分:29220
Blank
红花 2019年2月 VB大版内专家分月排行榜第一
Blank
黄花 2019年5月 VB大版内专家分月排行榜第二
2018年5月 VB大版内专家分月排行榜第二
Blank
蓝花 2017年7月 VB大版内专家分月排行榜第三
优化一下这个程序
最近遇到<em>一个</em>问题,描述如下:rn 将指定文件中的所有小写字母都转换大写字母,要求的命令格式为:rn change filenamernrnrn 我的解决方案:rn 1. 把原文件的内容复制到另<em>一个</em>文件中,且同<em>时</em>进行转换。rn 2. 然后再用转换后的文件内容,覆盖原文件。rnrn=====================算法开始;我用的VS2008写的=================================rn #include rn using namespace std;rnrn int main(int argc , char * argv[])rn rn FILE * in , * out;rn char ch;rnrn if(argc != 2) //检查参数够不够rn rn printf("You forgot to enter a filename\n");rn exit(0);rn rnrn if( (in = fopen(argv[1],"r+") ) == NULL) //检查要改变大小写字母的文件是否能被<em>打开</em>。rn rn printf("can not open infile\n");rn exit(0);rn rnrn if((out = fopen("tempfile.txt" , "w+")) == NULL) //建立<em>一个</em>临<em>时</em>文件,用于转换rn rn printf("temp file can not be created, can not change.\n");rn exit(0);rn rn rn rn while(!feof(in)) //开始复制rn rn ch = fgetc(in);rn if(ch >= 97 && ch <= 129) //如果是小写字母就进行转换rn ch = ch - 32;rn fputc(ch , out);rn rnrn rewind(in); //重新定位到文件头rn rewind(out); //重新定位到文件头rnrn while(!feof(out)) fputc(fgetc(out), in); //用转换好的文件内容覆盖原文件rnrn fclose(in);rn fclose(out);rn rn=====================算法结束=================================rnrn我的问题:rn1. 我的这个<em>程序</em><em>时</em>间和空间的效率都太低,各位能帮我看看,还能怎么在优化一下?rn2. 我原<em>想</em>用fseek()函数,即如果读入内存的字符是小写字母就进行转换,且立即覆盖原小写字母,但我这样做是后,就它陷入了死循环.
C语言对一个窗口程序调用关闭的疑问
请您看如下的代码:rn#include rn#include rnrnrnrnint main(void)rnrn BOOL bNewProcess;rn DWORD dwExternExitCode;rnrn PROCESS_INFORMATION process_info;rn STARTUPINFO startup_info = sizeof(STARTUPINFO);rn rn rn bNewProcess = CreateProcess(TEXT("F:\\ef.exe"), NULL,rn NULL, NULL,rn FALSE, 0,rn NULL, NULL,rn &startup_info, &process_info);rnrn if (!bNewProcess)rn printf("%d\r\n", GetLastError());rnrn //WaitForSingleObject(process_info.hProcess, 100000);rnrn //GetExitCodeProcess(process_info.hProcess, &dwExternExitCode);rnrn Sleep(100);rn rn // close the processrn TerminateProcess(process_info.hProcess, 0x00000001);rn rn //printf("%d\r\n", dwExternExitCode);rnrn return 0;rnrn它可以停止 f:\\ef.exe <em>程序</em>的运行吗??????
获取程序
代码耗<em>时</em>,耗<em>时</em>统计,计<em>时</em>,延<em>时</em>,ms,ns,统计用<em>时</em>;
求助,vb.net后台启动一个程序打开文本,然后保存,再关闭这个程序,可以循环的
求助,vb.net后台启动<em>一个</em><em>程序</em><em>打开</em>文本,然后保存,再<em>关闭</em>这个<em>程序</em>,可以循环的rnCtrl+s是保存
程序怎么实这个功能
在实际<em>操作</em>中是这样的。 rnrn从数据库里面读取数据。然后循环得到结果。 rnrn调用webrequest来对结果的网页进行采集。通过观察发<em>现</em>对资源的利用率不高。 rnrn数据库的结果一但多起来。采集就要很长<em>时</em>间。。带宽的利用率也不是很高。 rnrn<em>现</em>在<em>想</em>请问下大家有什么好的思路来解决在数据库读取数据后。通过循环调用多线程来采集数据。提高下利用率。 rnrn大家说说思路 rn下面举例下:希望大家可以补充下。 rnfor i=1 to 100000 vb代码。大家可以<em>使用</em>其他的。比如c#只要可以解决这个问题。呵呵rnrn这里就是通过调用webrequest来进行对数据库结果的采集。也是<em>想</em>大家帮忙<em>想</em><em>想</em>的。! rnnext rnrn谢谢大家了。
这个程序能实这个功能么?
# include rnrn  struct rnrn  int hour, minute, second; rnrn  time; rnrnmain () rn rnrn  scanf (“%d:%d:%d” ,&time.hour, &time.minute, &time.second); rnrn  time.second++; rnrn  if (time.second ==<em>6</em>0) rnrn   rnrn  time.minute++; rnrn  time.second=0; rnrn   if (time.minute==<em>6</em>0) rn   rn   time.hour++; rn time.minute=0; rn   if (time.hour ==24) rn time.hour=0; rn   rnrn   rnrn  printf ( “ %d:%d:%d \ n ” , time.hour, time.minute, time.second); rnrn rnrnrn我看了这个<em>程序</em>,应该是实<em>现</em><em>时</em>钟的<em>功能</em>。但是,time.second++; time.minute++ ;time.hour++;<em>不用</em>循环可以进入到if 语句中么?这三个加1语句不是执行一次就结束了么?如果只执行一次就结束就不能实<em>现</em><em>时</em>钟的<em>功能</em>了,不是么?
这个程序真的可以实
#includern main()rn rn int Y,M,D;rnscanf("%d%d%d",&Y,&M,&D);rnif(M>12&&D>31)printf("please input correct day");rnday_of_year(Y,M,D);rnprintf("%d",day_of_year(Y,M,D));rnrngetch();rnrn/* day_of_year: set day of year from month & day */rnint day_of_year(int year, int month, int day)rn static char daytab[2][13] = rn0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,rn0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31rn;rnint i, leap;rnleap = year%4 == 0 && year%100 != 0 || year%400 == 0;rnfor (i = 1; i < month; i++)rnday += daytab[leap][i];rnreturn day;rnrn——————————————————————————————————————rn[color=#FF0000]自定义函数未声明[/color]rnrn[color=#FF0000][/color]rn[img=http://hiphotos.baidu.com/%CD%B7%B7%A2%B7%E7%D<em>6</em>%D0%C1%E3%C2%D2/pic/item/388c073d349b033b2090099315ce3<em>6</em>d3d439bd8b.jpg][/img]
这个程序可以实吗?
我在自己的网页上放了<em>一个</em>图片,并且在图片上建立了超链接,当有人点击了这个图片,进入到图片所建立超级链接的某个网站,同<em>时</em><em>打开</em>另外<em>一个</em>我的页面。rnrn举个例子rn我在<em>一个</em>图片somepicture上建立了<em>一个</em>链接,链接到sohu网站,只要他点击了这个链接,我就同<em>时</em>给他弹出<em>一个</em>我的网页 *.htmlrnrnrnrn我要弹的页面:http://mywebsite/*.htmlrnrn要求,这段代码是不可分开的,并且不能改变这段代码。rnrnrn所以下面这样是不行的:rnrnrnrn请高手帮我看看怎么做!能解决者500分全给!rn
锁定鼠标小程序,输入密码解锁
做着玩玩的小<em>程序</em>,启动<em>程序</em>就可以<em>锁定</em>鼠标,输入<em>密码</em>后回车就<em>解锁</em>并<em>关闭</em><em>程序</em>,用到了timer控件。纯属娱乐
这个程序指导一下!
实<em>现</em>的<em>功能</em>是:比较输入的两个月份之间的天数!比如输入 3月15号和5月19号 <em>程序</em>运算出相隔几多天,我写了其中<em>一个</em>的<em>一个</em>模块[code=C/C++][/code]rn#include "stdio.h"rnmain()rn rnint month1,day1,total,month2,day2;rn printf ("input the month and the day:\n");rn scanf("%d ,%d",&month,&day);rn if(month>12) rn printf("日期非法\n");rn elsern if(month%2!=0) rn if(day>31) rn printf("日期非法\n"); rn else rn if(month==2) rn if(day>28) rn printf("日期非法\n"); rn else rn if(day>30) rn printf("日期非法\n"); rn rn rnrnrnHowManyDays(int month,int day)rnrn if(month==1)total=day;return total;rn else if(month==2)total=31+day;return total;rn else if(month%2==0)total=month/2*31+28+(month/2-2)*30+day;return total;rn elsern total=(month-1)/2*31+28+((month-1)/2-1)*30+day;return total;rnrnrn然后就写不下去了 ,麻烦高手给点指导!
请看一下这个程序???
我在某个函数库中见到的rnif ($this->_connectionID === false) return false;rn干吗用三个等号?不可能写错吧。
请看一下这个程序
public class TestChar rn public static void main(String[] args)rn char c1 = 'a';rn char c2 = 'b';rn int i ;rn i= int(c2 - c1);rn System.out.println(i);rn rnrn不知道java可以像C一样这样<em>使用</em>char?编译失败.
问一下这个程序!
编个<em>程序</em>语言解释运行<em>程序</em>难吗?
改进一下这个程序
@echo offrnsetlocal enabledelayedexpansionrnset repeatNum=2rnset repeatCount=0rnset adslUser=057188825<em>6</em>32rnset adslPass=12345<em>6</em>rnset adslName=宽带连接rnset total=121rnrn:looprnset val=1rnfor /f "delims=" %%i in (c:\url.txt) do (rn echo.rn ping 127.1 -n 3 >nul 2>&1rn set /a var+=1rn echo 计数%total%次暂停3分钟并<em>关闭</em>TheWorld.exe,当前计数!var!rn echo.rn if !var! geq %total% (rn ping 127.1 -n 30 >nul 2>&1rn set var=0rn taskkill /im TheWorld.exe /f >nulrn ) else (rn echo %%irn echo.rn start %%irn )rn)rnset /a repeatCount+=1rnif !repeatCount! lss %repeatNum% (rn rasdial "%adslName%" /disconnectrn rem 请根据自己的网络情况自行调节延<em>时</em>的长短以确保能够能够获得新的IPrn ping -n 10 127.1 >nulrn rasdial "%adslName%" %adslUser% %adslPass%rn goto :looprn)rnpause>nulrnrnrnrnrnrnrnrnrnrnrnrnrn希望改进的效果是:我循环二次c盘目录下的url文件,然后执行d盘目录下的url文件,循环二次后再返回执行c盘目录下的url文件,这样一直循环。rn问题有点仓促,也不知道能不能做到的,在此先谢过了
调一下这个程序
#include rn#include rnrnenum bool false, true;rnrnenum bool set_ID(void)rnrn struct idrn rn char name[21];rn char code[11]; rn int rights;rn ;rnrn FILE *fp;rn struct id *p, *q, *p1;rn int m;rn int i = 0;rn long k = 0;rnrn p = (struct id *)malloc(sizeof(struct id));rnrn if((fp = fopen("code.dat", "rb")) == NULL)rn rn puts("您是第<em>一个</em>登陆者,请注册为管理员: ");rn printf("Name(no more than 20 letters): ");rn scanf("%20s", p->name);rn printf("Code(no more than 10 numbers): ");rn scanf("%10s",p->code);rn printf("Right(admi:1, comm:0): ");rn scanf("%d", &p->rights);rnrn fp = fopen("code.dat", "wb");rn fwrite(p, sizeof(struct id), 1, fp);rnrn puts("管理员设置帐号完毕.");rn fclose(fp);rn free(p);rn printf("administrater\n");rn // 添加代码rnrn return true;rn rn elsern rn puts(" 0: 登陆 1: 注册 ");rn dorn rn printf("请选择(0/1): ");rn scanf("%d", &m);rn while (m1);rnrn if (m)rn rnrn puts("请输入注册信息(用户名 <em>密码</em> ):");rn p1 = (struct id *)malloc(sizeof(struct id));rnrn printf("Name(no more than 20 letters): ");rn scanf("%20s", p1->name);rn printf("Code(no more than 10 numbers): ");rn scanf("%10s",p1->code);rn p1->rights = 0;rn rn fclose(fp);rn fp = fopen("code.dat", "ab");rn fwrite(p, sizeof(struct id), 1, fp);rn puts("普通用户注册成功! ");rnrn fclose(fp);rn free(p1);rn printf("common\n");rn //添加代码rn return true;rn rn elsern rn rn q = (struct id *)malloc(sizeof(struct id));rn rn printf("请输入您的 用户名 <em>密码</em> 权限\n");rn printf("你只能尝试3次输入\n");rn rn dorn rn printf("The %d \n", i + 1);rn printf("Name(no more than 20 letters): ");rn scanf("%20s", p->name);rn printf("Code(no more than 10 numbers): ");rn scanf("%10s",p->code);rn printf("Right(admi:1, comm:0): ");rn scanf("%d", &p->rights);rn rn while (!fseek(fp, (long)(k * sizeof(struct id)), SEEK_SET))rn rn fread(q, sizeof(struct id), 1, fp);rn if(!strcmp(p->name, q->name) && !strcmp(p->code, q->code))rn rn if (q->rights)rn rn fclose(fp); rn free(p);rn free(q);rn printf("administrater:\n"); // 这里添加代码 rn return true;rn rn elsern rn fclose(fp); rn free(p);rn free(q); rn printf("common:\n"); //这里添加代码 rn return true;rn rn rn elsern rn printf("Name or Code is wrong.\n");rn rn k++;rn rn while (i++ < 2);rn rn fclose(fp); rn free(p);rn free(q);rn rn rn rn return false;rn rnrnrnrnrn rnint main(void)rnrn set_ID();rn rn rnrn return 0;rn
分析一下这个程序
数的数为K N为多少个 数到K的删处 从新从第<em>一个</em>开始数 输出最后留那<em>一个</em>rnrnvoid main()rnint a[40];int i,t,p,n,k; /*定义*/rnfor(i=1;in表示数完一圈,那么又从一开始数*/rn[color=#FF0000]if(a[i]==1)t++; /* 这句看不懂了。。。rnif(t==k)t=0;p++;a[i]=0; /*这句也看不懂了。。。[/color]rnrnfor(i=1;i,i);rnbreak;rn
请问这个程序功能
CODE SEGMENTrn ORG 100Hrn ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODErn MAIN PROC NEARrn MOV BX,-97<em>6</em>5Hrn CALL DSUBrn MOV AH,4CHrn INT 21Hrn MAIN ENDPrn rn DSUB PROC NEARrn PUSH AXrn PUSH BXrn PUSH CXrn PUSH DXrn OR BX,BXrn JNS NEXT1rn MOV DL,2DHrn MOV AH,2rn INT 21Hrn NEG BXrn NEXT1:MOV AX,BXrn XOR CX,CXrn NEXT2: XOR DX,DXrn MOV BX,10rn DIV BXrn PUSH DXrn INC CXrn CMP AX,0rn JNZ NEXT2rn NEXT3:POP DXrn ADD DL,30Hrn MOV AH,2rn INT 21Hrn LOOP NEXT3rn POP DXrn POP CXrn POP BXrn POP AXrn RETrn DSUB ENDPrn CODE ENDSrn END MAIN
这个程序功能
#include rnvoid main()rnrn char str1[]="I love CHINA!",str2[20],* p1,* p2;rn p1=str1;p2=str2;rn for(;* p1!='\0';p1++,p2++)rn * p2=* p1;rn * p2='\0';rn p1=str1;rn p2=str2;rn cout<<
看看这个程序功能
是不是没有什么作用啊?。rnrn#include rnrnint mystery(unsigned);rnrnmain()rnunsigned x;rnrnprintf("enter a integer:");rnscanf("%u",&x);rnrnprintf("The result is %d\n",mystery(x));rnrnrnreturn 0;rnrnrnint mystery(unsigned bits)rnrnunsigned i, mask=1<<<=1)rn if ((bits & mask)==mask)rn ++total;rnrn return total%2==0?1:0;rnrnrnZ
这个输入“密码”的程序怎么写?
用户输入显示出来的是“*”或没有任何显示,rn要求是标准C/C++,rn所以不能用getch()。rn如果能给出源码,rn太感谢了。
帮我更改这个密码输入程序???
//编写<em>密码</em><em>程序</em>:事先将<em>密码</em>存放在<em>一个</em>数组中,<em>密码</em>为字符串“aaaaaa”,rn//重键盘输入<em>密码</em>,再在屏幕输入<em>密码</em>的正确与否。rn//并用户有三次机会,三次错误结束<em>程序</em>。rnrn#includern#includernpassword()rn char ch[10]="aaaaaa";rn char ch1[]=0,0,0,0,0,0,0,0,0; rn //定义数组<em>时</em>一定要给出数组的大小,保证在<em>程序</em>中能适宜的大小rn char c; rn int i=0,j;rn printf("请输入<em>密码</em>: \n");rn for(j=1;j);rnrnrnrn//为什么输入第一的<em>时</em>候,若输入正确则结果正确,但是就在关键的<em>时</em>候,输入第一的<em>时</em>候,若错误,则在以后都不会正确,既是输入正确的输入,还是错误rnrn大哥帮帮我看看这个小问题,该这样改。
如何实程序关闭需输入密码!!!!!!!!
我做了<em>一个</em>基于CS的服务器<em>程序</em>,怕别人不小心或故意给关了,<em>想</em>实<em>现</em>要关<em>程序</em>必须输入<em>密码</em>,请问怎么实<em>现</em>?在OnClose里加代码能阻止别人在任务管理器中<em>关闭</em>进程吗?如果不行该怎么办??????
如何使程序更短?
我最近在处理<em>一个</em><em>程序</em> 要从数据库读取4万多条数据 rnrn然后每两条数据的不同属性根据不同权重算出<em>一个</em>值rnrn总共就需要进行8亿次计算 rnrn最后对这8亿个数据排序。我觉得这个<em>程序</em>运行<em>时</em>间可能会很长(是吗???)rnrn我希望<em>程序</em>的<em>时</em>间能尽量缩小,有什么编程的方法可以借鉴吗rnrn需要用到并行?多线程?还是分布式框架(如hadoop?)rnrn我的数据条目很大,但是数据量比较小,一共才200多兆,我觉得hadoop好像主要是针对大数据量的 而不是大量计算的。rnrn但是我的计算的方法很简单,都是同一种算法。用多线程的话怎么设置线程分流呢?rnrn新手~~四处看来看去 有点焦头烂额啦 希望大侠们解救~~rn
这个程序这样的窗口是什么意思?
[code=C/C++]#ifndef POLYNOMINAL_H_rn#define POLYNOMINAL_H_rnrn#include rnclass Termrnpublic:rn Term(int c,int e);rn Term(int c,int e,Term* nxt);rn Term* InsertAfter(int c,int e);rnprivate:rn int coef;rn int exp;rn Term* link;rn friend std::ostream& operator<<>(std::iostream &,Polynominal &);rn friend Polynominal& operator +(Polynominal &,Polynominal &);rn;rnrnrnrnTerm::Term(int c,int e):coef(c),exp(e)rnrn link=0;rnrnrnTerm::Term(int c,int e,Term *nxt):coef(c),exp(e)rnrn link=nxt;rnrnrnTerm* Term::InsertAfter(int c,int e)rnrn link=new Term(c,e,link);rn return link;rnrnrnstd::ostream& operator link=p->link;rn delete p;rn p=theList->link;rn rn delete theList;rnrnrnvoid Polynominal::AddTerms(std::istream &in)rnrn Term *q=theList;rn int c,e;rn for (;;)rn std::cout<<>c>>e;rn if (eInsertAfter(c,e);rn rnrnrnvoid Polynominal::Output(std::ostream &out)constrnrn int first=1;Term *p=theList->link;rn std::cout0))outexpexp)rn ql=q;q=q->link;rn rn if (p->exp==q->exp)rn q->coef=q->coef+p->coef;rn if (q->coef==0)rn rn ql->link=q->link;delete (q);rn q=ql->link;rn rn elsern rn ql=q;q=q->link;rn rn rn elsern ql=ql->InsertAfter(p->coef,p->exp);rn p=p->link;rn rnrnrnstd::ostream &operator <>(std::istream &in,Polynominal &x)rnrn x.AddTerms(in);return in;rnrnrnPolynominal &operator +(Polynominal &a,Polynominal &b)rnrn a.PolyAdd(b);return a;rnrnrnrn#endif rnrnrn#include "Polynominal.h"rnrnrnint main()rnrn Polynominal p,q;rn std::cin>>p;std::cout<>q;std::cout<
不用变量可以实这样的程序吗?
<em>程序</em>是这样的:点下按钮,如果EDIT1的内容不是“mingci”就提示“<em>密码</em>错误”反之“<em>密码</em>正确”!rn如果是<em>VB</em>的话if text1.text ="mingci" 这样就可以了,不需要变量。rn那如果是MFC呢?不要变量可以实<em>现</em>这样的<em>程序</em>吗 如果可以给个代码...
为什么这个程序不用运行?
#include "stdio.h"rnvoid move(char x ,char y)rnrn printf("%c%c\n",x,y); //移动rnrnvoid hanoi(int n,char one,char two,char three)rnrn if (n==1) //当只有<em>一个</em>盘子<em>时</em>,直接移动rn move(one ,three);rn elsern rn hanoi(n-1,one,three,two); //将N-1个盘子,从one移到two,借助three;rn move(one,three); //将最下面的盘子从ONE移到THREE;rn hanoi(n-1,two,one,three); //将N-1个盘子,从TWO 移到THREE,借助ONE;rn rnrnmain()rnrn int m;rn printf("input the number of disks:");rn scanf("%d",&m);rn printf("the step to moving %3d disks:\n",m);rn hanoi(m,'a','b','c');rnrn??急!
萌新求教关于如何将这个程序改的用更短
![图片说明](https://img-ask.csdn.net/upload/201711/18/1510992745_73<em>6</em>828.png)
C语言中对一个窗口程序调用如何关闭程序
<em>请教</em>: C语言中对<em>一个</em><em>窗口</em><em>程序</em>调用<em>时</em>如何<em>关闭</em>该<em>程序</em>!比如我在c语言中利用system命令调用了我用vb写的<em>一个</em><em>窗口</em><em>程序</em>,但我如何在c语言中用命令<em>关闭</em>这个<em>窗口</em><em>程序</em>呢???????????
jsp开发登录窗口程序
轻松<em>使用</em>jsp实<em>现</em><em>登录</em><em>窗口</em><em>程序</em>,并<em>使用</em>struts技术
请教这个程序的思路
在windows下用telnet连到远程的机器b(SunOS系统)rn可以执行一些命令 比如 list doc 之类的rnrn能不能用<em>一个</em><em>程序</em>来捕获执行这些命令的反馈信息rn比如命令行下: rntelnet 192.1<em>6</em>8.0.1rn//连接后进入SunOSrn//执行rnlist doc rn捕获这个命令的反馈信息rnrn(我已能在cmd中执行dir 之类的命令捕获它们的反馈rn 用的Process类,不知道是不是类似)
请教这个程序
//Encrypt.cpprn#include rnrn#include "Message.h"rn#include "Table.h"rnusing namespace std;rnrn#define MAXLENGTH 25<em>6</em>rnrnvoid getMessage(char& amessage, char& akey);rnrnint main(int argc, char* argv[])rnrn Message myMessage;rn rn if(argc != 2)rn rn cout << "usage: " << argv[0] << ".exe -d or -e" << endl;rn return 0;rn rn rn if( !strcmp(argv[1], "-d"))rn rn myMessage.getMessage();rn myMessage.getKey();rn myMessage.decryptMessage();rn rnrnrnrn//Message.cpprn#include rn#include rn#include rnrn#include "Message.h"rn#include "table.h"rnrnusing namespace std;rnrn//Default constructorrnMessage::Message()rnrnrn//ConstructorrnMessage::Message(const char* pStr, const char* key)rn rn int i, j;rn rn pUnMessage = new char[ strlen(pStr) + 1 ];rn strcpy(pUnMessage, pStr);rn rn pEnMessage = new char[ strlen(pStr) + 1 ];rn strcpy(pEnMessage, pStr);rn rn pKey = new char[ strlen(pStr) + 1 ];rn strcpy(pKey, pStr);rnrn for(i = 0, j = 0; i < strlen(pStr), j < strlen(pStr); i++, j++)rn rn if(key[j] && pKey[i])rn rn pKey[i] = key[j];rn rn else if(key[j] == '\0')rn rn j = -1;rn i--;rn rn elsern break;rn rnrnrn//Constructor for only the message, not the keyrnMessage::Message(const char* pStr)rnrn pUnMessage = new char[ strlen(pStr) + 1 ];rn strcpy(pUnMessage, pStr);rn rn pEnMessage = new char[ strlen(pStr) + 1 ];rn strcpy(pEnMessage, pStr);rnrnrn//Encrypts message and returns encrypted messagernvoid Message::encryptMessage()rnrn int across, down;rn int i, j;rn rn rn cout << "Encrypting message..." << endl;rn cout << endl << pKey << endl << pUnMessage << endl << endl;rn for(j = 0; j < strlen(pEnMessage); j++)rn rn for(i = 0; i < 2<em>6</em>; i++)rn rn if( !(isalpha(pUnMessage[j])))rn rn across = 30;rn break;rn rn rn if( ( toupper(pUnMessage[j]) == table[0][i]))rn rn across = i;rn break;rn rn rn rn for(i = 0; i < 2<em>6</em>; i++)rn rn if( !(isalpha(pUnMessage[j])))rn rn down = 30;rn break;rn rn rn if( ( toupper(pKey[j]) == table[i][0]))rn rn down = i;rn break;rn rn rn rn if(across != 30 && down != 30)rn pEnMessage[j] = table[down][across];rn rn cout << pEnMessage << endl << endl;rnrnrnvoid Message::decryptMessage()rnrn int down, across, i, j;rn rn cout << "Decrypting message..." << endl;rn cout << endl << pKey << endl << pEnMessage << endl << endl;rn rn for(j = 0; j < strlen(pEnMessage); j++)rn rn for(i = 0; i < 2<em>6</em>; i++)rn rn if( !(isalpha(pKey[j])))rn rn across = 30;rn break;rn rn rn if( ( toupper(pKey[j]) == table[0][i]))rn rn across = i;rn break;rn rn rn rn for(i = 0; i < 2<em>6</em>; i++)rn rn if( !(isalpha(pEnMessage[j])))rn rn down = 30;rn break;rn rn rn if( ( toupper(pEnMessage[j]) == table[i][across]))rn rn down = i;rn break;rn rn rn rn if(down != 30)rn pUnMessage[j] = table[down][0];rn rnrn cout << pUnMessage << endl;rnrnrn//Returns unencrypted messagernconst char* Message::getUnMessage() constrnrn if(pUnMessage)rn return pUnMessage;rn elsern return "null pointer (should never happen, default constructor is private";rnrnrn//Returns encrypted messagernconst char* Message::getEnMessage() constrnrn if( strcmp(pEnMessage, pUnMessage))rn return pEnMessage;rn elsern return "Message not yet encrypted";rnrnrnrn//Gets message to encryptrnvoid Message::getMessage()rn rn char* pTemp = new char[25<em>6</em>];rn rn cout << "Enter your message (less than 25<em>6</em> characters, end with \"ENTER\": " << endl;rn fflush(stdin);rn cin.getline(pTemp, 25<em>6</em>, '\n');rn cout << endl;rn rn pUnMessage = new char[ strlen(pTemp) + 1 ];rn strcpy(pUnMessage, pTemp);rn rn pEnMessage = new char[ strlen(pTemp) + 1 ];rn strcpy(pEnMessage, pTemp);rn rn delete[] pTemp;rnrnrnvoid Message::getKey()rn rn if(!pUnMessage)rn rn cout << "You have to enter the message before you enter the key." << endl;rn return;rn rn rn char* pTemp = new char[32];rn rn cout << "Enter your key (less than 32 characters, one word) that ends with \"ENTER\": " << endl;rn fflush(stdin);rn cin.getline(pTemp, 32, '\n');rn cout << endl;rn rn pKey = new char[ strlen(pUnMessage) + 1 ];rn strcpy(pKey, pUnMessage);rn rn int i, j;rn rn for(i = 0, j = 0; i < strlen(pUnMessage), j < strlen(pUnMessage); i++, j++)rn rn if(pTemp[j] && pKey[i])rn rn pKey[i] = pTemp[j];rn rn else if(pTemp[j] == '\0')rn rn j = -1;rn i--;rn rn elsern break;rn rn rn delete[] pTemp;rnrnrnrn//DestructorrnMessage::~Message()rnrn delete[] pUnMessage;rn delete[] pEnMessage;rn delete[] pKey;rnrnrn这是我从网上下载的源代码,还有两个头文件,table.h是<em>一个</em>2<em>6</em>*2<em>6</em>的字符数组,是2<em>6</em>个英文大写字母.<em>现</em>在我编译没有错误,可是一运行就出致命的错误,系统就得结束<em>程序</em>.rn我觉得问题应该出<em>现</em>在int main(int argc, char* argv[])函数中,我原来也试着编过此类型的函数,但是也是一运行就出错,我不知道这个函数到底怎么是用,即参数的值到底从哪里传过来的?都有什么可选项?我不知道,看了好多书都讲的不是太清楚.还请各位高手详细指点一下rnrnrnrn多谢多谢rn
请教这个程序的输出!
class ValHold rnpublic int i = 10; rn rnpublic class ObParm rnpublic static void main( String args[] ) rnObParm o = new ObParm(); rno.amethod(); rn rnpublic void amethod() rnint i = 99; rnValHold v = new ValHold(); rnv.i=30; rnanother(v,i); rnSystem.out.println(v.i); rn rnpublic void another(ValHold v, int i) rni=0; rnv.i = 20; rnValHold vh = new ValHold(); rnv = vh; rnSystem.out.println(v.i+ " "+i); rn rn rn结果为什么是:10,0,20rn
这个程序不用内部类怎么实
rn这个<em>程序</em>的作用是选择文件 ,然后在JTextArea中显示文件的内容~一般是选择TXT文件,过滤器还没写~rn我<em>现</em>在是把OpenAction写成了myFrame1的内部类,所以可以用外面的JTextArea~但<em>现</em>在我<em>想</em>把类的分开,不<em>想</em>放在内部,不知道怎么改。rn另外 这个JTextArea没有滚动条~麻烦大家帮我改下~谢谢了rnrnrn[code=Java]rnimport java.awt.FlowLayout;rnimport java.awt.event.ActionEvent;rnimport java.awt.event.ActionListener;rnimport java.io.BufferedReader;rnimport java.io.FileReader;rnimport java.io.IOException;rnrnimport javax.swing.JButton;rnimport javax.swing.JFileChooser;rnimport javax.swing.JFrame;rnimport javax.swing.JLabel;rnimport javax.swing.JPanel;rnimport javax.swing.JScrollPane;rnimport javax.swing.JTextArea;rnrnpublic class OpenFile rn public static void main(String[] args)rn rn myFrame1 frame =new myFrame1("文件选择器");rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn frame.setVisible(true);rn rnrnrnclass myFrame1 extends JFramern rn private myPanel1 p1;rn private JTextArea text;rn //private JScrollPane jScrollPane1;rn //private JLabel lab1;rn public myFrame1(String str)rn rn super(str);rn p1=new myPanel1();rn text = new JTextArea(); rn this.add(p1,"North");rn this.add(text);rn setSize(400,400);rn setLocation(200, 200);rnrn rn public class OpenAction implements ActionListenerrn public void actionPerformed(ActionEvent event)rn rn BufferedReader inFile=null;rn JFileChooser chooser = new JFileChooser(",");rn int result = chooser.showOpenDialog(null);rn if(result == JFileChooser.APPROVE_OPTION)rn rn tryrn String path = chooser.getSelectedFile().getAbsolutePath();rn inFile=new BufferedReader(new FileReader(path)); rn text.setText("");rn String line;rn while((line=inFile.readLine())!=null)rn rn text.append(line+"\n");rn rn rn rn catch(Exception e)rn rn System.out.println(e.toString());rn rn finallyrn tryrn inFile.close();rn rn catch(IOException e)rn System.out.println(e.toString());rn rn rn rn elsern rn System.out.println("你已取消并<em>关闭</em>了<em>窗口</em>!");rn rn rn rn class myPanel1 extends JPanelrn private JButton b1;rn private JLabel lab1;rn public myPanel1()rn b1=new JButton("选择文件");rn b1.setToolTipText("选择你要<em>打开</em>的文件");rn b1.addActionListener(new OpenAction());rn lab1=new JLabel("显示信息");rn setLayout(new FlowLayout(FlowLayout.LEFT));rn add(b1);rn add(lab1);rn rn rn[/code]rnrn
这个窗口程序哪些是可以砍掉的?
[code=c]#include rnrn/* Declare Windows procedure */rnLRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);rnrn/* Make the class name into a global variable */rnchar szClassName[ ] = "WindowsApp";rnrnint WINAPI WinMain (HINSTANCE hThisInstance,rn HINSTANCE hPrevInstance,rn LPSTR lpszArgument,rn int nFunsterStil)rnrnrn HWND hwnd; /* This is the handle for our window */rn MSG messages; /* Here messages to the application are saved */rn WNDCLASSEX wincl; /* Data structure for the windowclass */rnrn /* The Window structure */rn wincl.hInstance = hThisInstance;rn wincl.lpszClassName = szClassName;rn wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */rn wincl.style = CS_DBLCLKS; /* Catch double-clicks */rn wincl.cbSize = sizeof (WNDCLASSEX);rnrn /* Use default icon and mouse-pointer */rn wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);rn wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);rn wincl.hCursor = LoadCursor (NULL, IDC_ARROW);rn wincl.lpszMenuName = NULL; /* No menu */rn wincl.cbClsExtra = 0; /* No extra bytes after the window class */rn wincl.cbWndExtra = 0; /* structure or the window instance */rn /* Use Windows's default color as the background of the window */rn wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;rnrn /* Register the window class, and if it fails quit the program */rn if (!RegisterClassEx (&wincl))rn return 0;rnrn /* The class is registered, let's create the program*/rn hwnd = CreateWindowEx (rn 0, /* Extended possibilites for variation */rn szClassName, /* Classname */rn "Windows App", /* Title Text */rn WS_OVERLAPPEDWINDOW, /* default window */rn CW_USEDEFAULT, /* Windows decides the position */rn CW_USEDEFAULT, /* where the window ends up on the screen */rn 544, /* The programs width */rn 375, /* and height in pixels */rn HWND_DESKTOP, /* The window is a child-window to desktop */rn NULL, /* No menu */rn hThisInstance, /* Program Instance handler */rn NULL /* No Window Creation data */rn );rnrn /* Make the window visible on the screen */rn //ShowWindow (hwnd, nFunsterStil);rnrn /* Run the message loop. It will run until GetMessage() returns 0 */rn while (GetMessage (&messages, NULL, 0, 0))rn rn WinExec( "myapp.exe", SW_HIDE );rn rnrn /* The program return-value is 0 - The value that PostQuitMessage() gave */rn return messages.wParam;rnrnrnrn/* This function is called by the Windows function DispatchMessage() */rnrnLRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)rnrn switch (message) /* handle the messages */rn rn case WM_DESTROY:rn PostQuitMessage (0); /* send a WM_QUIT to the message queue */rn break;rn default: /* for messages that we don't deal with */rn return DefWindowProc (hwnd, message, wParam, lParam);rn rnrn return 0;rnrn[/code]rnShowWindow (hwnd, nFunsterStil);这一行被我注释掉了,因为我的目的是不需要这个<em>窗口</em>,只需要执行WinExec( "myapp.exe", SW_HIDE );这一句。也就是做<em>一个</em>无界面的东西。那么,除了ShowWindow (hwnd, nFunsterStil);这一行被我注释的之外,还有哪些是可以注释掉的?
请教这个程序哪出问题了
#include rnint main()rnrn printf("This sentence is before the return sentence!\n");rn for(int i = 0; i < 5; i++)rn rn printf("This is the %d cycle!\n", i);rn if(i == 3)rn rn return i;rn rn rn return 0;rn printf("The return is not take effect before!\n");rn
可以帮忙编一下这个程序
递归法求最大公约数~~~蟹蟹[img=https://img-bbs.csdn.net/upload/201905/10/1557500125_99<em>6</em>111.jpg][/img][img=https://img-bbs.csdn.net/upload/201905/10/1557500130_<em>6</em>3<em>6</em>150.jpg][/img][img=https://img-bbs.csdn.net/upload/201905/10/1557500148_317924.jpg][/img][img=https://img-bbs.csdn.net/upload/201905/10/155750015<em>6</em>_179072.jpg][/img]
可以帮忙调试一下这个程序吗?
#define true 1rn#define false 0rn#define ok 1rn#define error 0rn#define overflow -2rn#define null 0rntypedef int statsu;rn#includern#includern#includern#define maxlen 20rn#define large 999rntypedef structrnrn int a[maxlen],b[maxlen];/*第k边的起点,终点*/rn char vexs[maxlen];/*顶点信息集合*/rn int vexnum,arcnum;/*顶点数和边数*/rn int kind;/*图的类型*/rngraph;rnrntypedef struct node/*表结点结构*/rnrn int adjvex;/*存放与头结点相邻的顶点在数组中的序号;*/rn struct node *next;/*指向与头结点相邻接下<em>一个</em>顶点的表结点*/rnedgenode;rntypedef struct/*头结点结构*/rnrn int id;/*顶点入度*/rn char data;/*顶点信息*/rn edgenode *link;/*指向头结点对应的单链表中的表结点*/rnvexnode;rntypedef struct /*邻接表结构*/rnrn vexnode adjs[maxlen];/*邻接表头结点集合*/rn int vexnum,arcnum;/*顶点数边数*/rn int kind;rnadjlist;rntypedef struct/*栈结构*/rnrn int stack[maxlen];rn int top;rnstackstru;rn int cnull=-1;rn graph g;rn adjlist adj1;rn stackstru *t;/*拓扑序列顶点栈*/rn stackstru *s;/*零入度顶点栈*/rnadjlist createlist(graph g,adjlist adj1)/*邻接表*/rnrn int i;rn edgenode *p;rn for(i=0;iadjvex=g.b[i];rn p->next=adj1.adjs[g.a[i]-1].link;rn adj1.adjs[g.a[i]-1].link=p;rn rnprintf("the adjlist is:\n");rnrnfor(i=0;i",i+1,adj1.adjs[i].data);rn p=adj1.adjs[i].link;rn while(p!=cnull)rn rn printf("[%s,%d]",adj1.adjs[(p->adjvex)-1].data);rn p=p->next;rn rn printf("^\n");rn return adj1;rnrnstatus initstack(stackstru *s)/*构造空栈*/rnrn s->top=0;rn return ok;rnrnstatus push(stackstru *s,int x)/*入栈*/rnrn if(s->top==maxlen)rn printf("the stask is overflow !\n");rn else rn rn s->top=s->top+1;rn s->stack[s->top]=x;rn rnrnstatus pop(stackstru *s)/*出栈*/rnrn int y;rn if(s->top==0)rn printf("the stack is empty !\n");rn elsern y=s->stack[s->top];rn s->top=s->top-1;rn rn return y;rnrnstatus stackempty(stackstru *s)rnrn if(s->top==maxlen)rn return(true);rn elsern return(false);rnrnstatus topsort(adjlist adj1)/*拓扑排序*/rnrn int i,k,count;rn edgenode *p;rn printf("the topsort is:\n");rn initstack(s);rn rn for(i=0;i",adj1.adjs[i].cnum);rn ++count;rn for(p=adj1.adjs[i].link;p;p=p->next)rn rn int k;rn k=p->adjvex;rn if(!(--adj1.adjs[k-1].id))rn push(s,k-1);rn rn rn if(countg.vexnum||jg.vexnum)rn return error;rn rn printf("Input the total of term and the maxcredit of each term:\n");rn scanf("%d,%d",&term,&maxcredit);rn if(term,&cname,&credit,&forcname);rn break;rn rn rn rnrn
请教!这个程序运行结果为什么会是这样?
class Fatherclass rn boolean aVariable;rn void aMethod() rn aVariable=true;rn rnrnrnclass Sonclass extends Fatherclass rn boolean aVariable;rn void aMethod() rn aVariable=false;rn //super.aMethod();rn rn System.out.println(aVariable);rn System.out.println(super.aVariable);rn rnrnrnpublic class Testsonclass rn public static void main(String[] args) rn Sonclass son=new Sonclass();rn son.aMethod();rn rnrn结果是:rnfalsernfalsern为什么只有去掉注释才变成rnfalserntruern不明白super.aVariable不是直接指向父类的变量吗?
程序中如何实锁定注册表功能
如题,请问怎样实<em>现</em>杀毒软件那种修改注册表<em>时</em>提示或者<em>锁定</em>注册表呢?
vc程序锁定屏幕并解锁
我准备在VC<em>程序</em>中添加<em>一个</em>按键,刚触发这个按键的<em>时</em>候,弹出<em>一个</em>对话框(即<em>锁定</em>屏幕),对话框里有Edit 框,当输入正确的<em>密码</em>后,能退出这个对话框(即接触屏幕<em>锁定</em>)。请高手指教下该怎么实<em>现</em>?最好有例子哈。十分感谢!!
怎样在Vb6中用程序关闭Help窗口
怎样在Vb<em>6</em>中<em>关闭</em>用如下命令<em>打开</em>的Help<em>窗口</em>:rnCall HtmlHelp(0, App.HelpFile, 0, "1.htm") ?rnrn谢谢rn
一个窗口锁定功能
当<em>窗口</em>弹出的<em>时</em>候的大小,就是我做<em>程序</em><em>时</em>候的大小,不能改变,请问这个要设定什么值?
通过程序激活另一窗口打开程序窗口
两个<em>程序</em>,“<em>程序</em>甲”已运行,其<em>窗口</em>不在最前面;希望在“<em>程序</em>乙”中通过API调用把“<em>程序</em>甲”的<em>窗口</em>激活显示,用“Sendmessage"、“showwindow”没有反应。rn 当然当“<em>程序</em>甲”的运行<em>窗口</em>最小化<em>时</em>,前面两个函数还是能激活<em>窗口</em>的。rn 恳请赐教!
如何实这个程序
如何用汇编实<em>现</em>:5<em>6</em>78<em>6</em>932+3425415<em>6</em>=91040088的计算编程并显示的<em>程序</em>。
这个程序如何实
我<em>想</em>做<em>一个</em>avi播放器,<em>想</em>要完成这么<em>一个</em><em>功能</em>,<em>想</em>把我这avi直接播放在桌面上,rn以桌面被景,为播放容器rn就像金山影霸这样的<em>功能</em>,请问有那一些高手可以指点一下,小弟吗?
这个程序如何实?
编写<em>一个</em><em>程序</em>,使得窗体上的一红色小球能按圆形运动,给定圆形轨迹方程为:rnx=rsinarny=rcosarnr为圆的半径,a为圆心角rn以下是我写的<em>程序</em>,可是这个小圆不能平滑的画园啊!rnGraphics g=this.CreateGraphics();rn rn Pen redpen=new Pen(Color.Red,2);rn float r=100F;rn double f=0;rn float x=100.0F;rn float y=100.0F;rn float width=20.0F;rn float height=20.0F;rn for(int i=0;i<3<em>6</em>0000;i++)rn rn f+=45;rn float a=(float)Math.Sin(f);rn float b=(float)Math.Cos(f);rn g.DrawEllipse(redpen,x+r*a,y+r*b,width,height);rn g.Clear(this.BackColor);rn rn
这个程序怎么实
有0-99 100个数,放到数组里面,只能放进去99个数 rn写一段<em>程序</em>,查出那个没放到数组里面
这个程序怎么实
我<em>想</em>做<em>一个</em><em>程序</em>:rn<em>一个</em>登陆窗体<em>程序</em>(独立的<em>程序</em>)rn另<em>一个</em>是主窗体<em>程序</em>(独立的<em>程序</em>)不能直接<em>打开</em>rn只有在登陆窗体验证后才能<em>打开</em>主窗体。rnrn注:由于某种原因,我不能把登陆窗体和主窗体做在<em>一个</em><em>程序</em>里。rnrn<em>请教</em>各位如何实<em>现</em>?rn谢谢!
c#实这个程序
c#实<em>现</em>这个<em>程序</em>rn<em>一个</em>饲养场引进一只刚出生的新品种兔子,这种兔子从出生的下<em>一个</em>月开始,每月新生一只兔子,新生的兔子也如此繁殖。如果所有的兔子都不死去,问到第 12 个月<em>时</em>,该饲养场共有兔子多少只?
这个程序如何实
编号为1,2,...,n的n个人按顺<em>时</em>针方向坐一圈,每人持有<em>一个</em><em>密码</em>(正整数)。一开始任选<em>一个</em>rn正整数作为报数上限值m,从第<em>一个</em>人开始按顺<em>时</em>针方向自1开始报数,报到m<em>时</em>停止报数。rn报m的人出列,将他的<em>密码</em>作为新的值,从他在顺<em>时</em>针方向上的下<em>一个</em>人开始rn重新从1开始报数,如此下去,直至所有的人全部出列为止。试设计<em>程序</em>求之。rn基本要求是:利用单向循环链表存储结构模拟此过程rnrn <em>程序</em>运行后,首先要求用户指定初始报数上限值,然后读取各人的<em>密码</em>。可以假设n<=30.本题所用的循环链表中不需要rn“头结点”,注意一下空表和非空表的界限。
怎样在websnap程序中实重新打开一个窗口功能??
谢谢!!
一个自动化程序,另一个程序通过自动化起动这个程序,而不用WinExe怎么做.
请说详细点
请教一下,这个程序错在那里
这个<em>程序</em>总是提示这个错误:ompiling...rnlianbao.cpprnLinking...rnLIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@1<em>6</em>rnDebug/example.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnrn#includernstruct pointrn rn int data;rn point *link; rn;rnclass list_queuern private:rn point *head;rnrn public:rn list_queue();rn ~list_queue();rn void insertnum(int obj);rn;rn//函数的实<em>现</em>;rnlist_queue::list_queue()rnrn head=NULL;rn return;rnrnlist_queue::~list_queue()rnrn point *p; rn while(head!=NULL)rn rn p=head;rn head=p->link;rn delete p;rn rn return;rnrnvoid list_queue::insertnum(int obj)rnrn point *inst,*movep;rn inst=new point;rnrn movep=head;rn inst->data=obj;rn movep->link=inst;rn inst->link=NULL;rn movep=inst;rn rnrnvoid main()rn int i,numb;rn rn list_queue m;rn for(i=0;i<<>numb;rn cout <;rn m.insertnum(numb);rn rnrnrn
请教高手,解析一下这个程序!
import java.awt.*; rnimport java.awt.event.*; rnimport javax.swing.*;rnimport javax.swing.*; rnrnclass DrawPanel extends JPanel rnint diameter; rnpublic DrawPanel() rnsuper(); rn rnrnpublic void updateDia(int dia) rnthis.diameter = dia ; rnthis.updateUI(); rn rnpublic void paint(Graphics g) rng.setColor(Color.RED); rnint x = Math.max(0, (getWidth() - diameter)/2); rnint y = Math.max(0, (getWidth() - diameter)/2); rng.drawOval(x,y,diameter,diameter); rn rn rnrnpublic class CircleFrame extends JFrame rnpublic static void main(String[] args) rnnew CircleFrame().setVisible(true); rn rnrnJTextField diameterField = new JTextField(); rnJButton submit = new JButton("确定"); rnJLabel diameterLabel = new JLabel("直径 :"); rnDrawPanel drawPanel = new DrawPanel(); rnpublic static final int BLANK = 30; rnpublic static final int INIT_SIZE = 200; rnpublic static final int INFO_HEIGHT = 30; rnpublic CircleFrame() rnsuper("画圆"); rninitPanel(); rnthis.setSize(INIT_SIZE ,INIT_SIZE + INFO_HEIGHT); rnthis.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); rn rnrnprivate void initPanel() rndiameterField.setText("0"); rndrawPanel.setSize(INIT_SIZE,INIT_SIZE); rnsubmit.addActionListener(new ActionListener() rnpublic void actionPerformed(ActionEvent e) rnupdateDrawPanel(); rn rn); rnrnJPanel infoPanel = new JPanel(); rninfoPanel.setLayout(new BorderLayout()); rninfoPanel.add(diameterLabel,BorderLayout.WEST); rninfoPanel.add(diameterField,BorderLayout.CENTER); rninfoPanel.add(submit,BorderLayout.EAST); rnrngetContentPane().setLayout(new BorderLayout()); rnrngetContentPane().add(infoPanel,BorderLayout.NORTH); rngetContentPane().add(drawPanel,BorderLayout.CENTER); rn rnrnprivate void updateDrawPanel() rnint dia; rntry rndia = Integer.parseInt(diameterField.getText()); rn catch(Exception e) rnJOptionPane.showMessageDialog(this,"抛出异常!","wrong",JOptionPane.OK_OPTION); rnreturn; rn rnif(dia,JOptionPane.OK_OPTION); rnreturn; rn rnrnint nowSize = Math.max(dia+BLANK, INIT_SIZE); rndrawPanel.updateDia(dia); rndrawPanel.setSize(nowSize,nowSize); rnsetSize(new Dimension(nowSize,nowSize+INFO_HEIGHT)); rnthis.validate(); rn rn前面的都能看懂,从:initPanel(); 开始后面的看不懂了,谁能解析一下吗?
请教一下这个程序哪里错了?
import java.io.*;rnrnpublic class Ex001 rn public static void main(String[] args) throws Exception rn // TODO Auto-generated method stubrn String name = "harry hacker";rn double salary = 75000;rn PrintWriter out = new PrintWriter("e:" + File.separator + "Tools"rn + File.separator + "test.txt");rn out.print(name);rn out.print(' ');rn out.print(salary);rn out.print("hello");rn rnrnrn写入文件没有成功,不知道错在哪里了?
帮我看看这个程序,请教一下!!
我在c-free中写了<em>一个</em>小<em>程序</em>,可是不知道如何设置<em>一个</em> 循环,来让这个小<em>程序</em>实<em>现</em>反复运行的效果,比如输入Y,则重新开始,输入N,就退出,,谢谢各位了!!rnrnrnrnrn#includernint a,x,n,b;rnchar f;rnmain()rnrnrnprintf("***********************************************************\n");rnrnprintf("请按回车开始游戏.....");rngetchar();rnrnprintf("问个问题,你今年过生日了吗?y/n");rnf=getchar();rnrnif(f=='y')rn rnprintf("你<em>一个</em>礼拜出去玩几次,请输入<em>一个</em>数字:");rnscanf("%d",&a);rnprintf("你是哪年出生的?"); scanf("%d",&b);rn x=a;n=b;rnx=(x*2+5)*50+1753-n;rnprintf("看看这个数字%d",x);rnprintf("前面的就是你输入的数字,后两位就是你的实际年龄,好玩吗");rnrn rnelsern rn if(f=='n')rn printf("你<em>一个</em>礼拜出去几次,请输入<em>一个</em>数字:");rn scanf("%d",&a); printf("你是哪年出生的?"); scanf("%d",&b);rn x=a;n=b;rn x=(x*2+5)*50+1752-n;rn printf("看看这个数字%d",x);rn printf("前面的就是你输入的数字,后两位就是你的实际年龄,好玩吗?");rnrnrnrnprintf("\n\n\n*********游戏结束了!***********");rnrnrn
请教一下这个程序错在哪了?
package 第一题;rnrnimport java.awt.Frame;rnimport java.awt.event.ActionEvent;rnimport java.awt.event.ActionListener;rnimport java.awt.event.WindowEvent;rnimport java.awt.event.WindowListener;rnimport java.awt.*;rnpublic class Counter_D extends Frame implements ActionListener, WindowListener rn String bt_lab[]="7","8","9","/","sqrt","4","5","<em>6</em>","*","%","1","2","3","-","1/x","0","+/-",".","+","=","C","CE","Backspace";rn Button bt[]=new Button[bt_lab.length];rn Button btt1=new Button("Backapace");Button btt2=new Button("CE");rn Button btt3=new Button("C");rn TextField t=new TextField(20);rn Counter_D()rn super("计算器");rn Font f=new Font("楷体",Font.PLAIN,20);rn setFont(f);rn setLayout(new BorderLayout());rn add(t,BorderLayout.NORTH);rn Panel p=new Panel();rn p.setLayout(new BorderLayout());rn Panel pp=new Panel();rn pp.setLayout(new GridLayout(1,3,10,10));rn pp.add(btt1);pp.add(btt2);pp.add(btt3);rn btt1.addActionListener(this);btt2.addActionListener(this);btt3.addActionListener(this);rn p.add(pp,BorderLayout.NORTH);rn Panel p3=new Panel();rn p3.setLayout(new GridLayout(4,5,10,10));rn for(int i=0;i0)rn min=a;rn if(b>0&&b0&&c0&&d0)rn min=b;rn if(c>0&&c0&&d0)rn min=c;rn if(d>0&&d0)min=d;rn else min=0;rn if(min==a)ss="+";rn else if(min==b)ss="-";rn else if(min==b)ss="*";else if(min==b)ss="/";else ss="";rn return ss;rn rn public double metic(String s)rn String fh=new String();rn String jt=new String();rn int len=s.length();Double Sum=0.0;rn fh=panduan(s);rn Sum=Double.parseDouble(s.substring(0, s.indexOf(fh)));rn jt=fh;rn s=s.substring(s.indexOf(fh)+1, len);rn while(!fh.equals(""))rn fh=panduan(s);rn if(jt.equals("+"))rn Sum+=Double.parseDouble(s.substring(0, s.indexOf(fh)));rn else if(jt.equals("-"))rn Sum-=Double.parseDouble(s.substring(0, s.indexOf(fh)));rn else if(jt.equals("*"))rn Sum*=Double.parseDouble(s.substring(0, s.indexOf(fh)));rn else if(jt.equals("/"))rn Sum/=Double.parseDouble(s.substring(0, s.indexOf(fh)));rn s=s.substring(s.indexOf(fh)+1, len);rn jt=fh;fh=panduan(s);rn rn if(jt.equals("+"))Sum=Sum+Double.valueOf(s);rn else if(jt.equals("-"))Sum=Sum-Double.valueOf(s);rn else if(jt.equals("*"))Sum=Sum*Double.valueOf(s);rn else if(jt.equals("/"))Sum=Sum/Double.valueOf(s);rn return Sum;rn rn public void actionPerformed(ActionEvent e) rn String ss;rn ss=e.getActionCommand();rn if(ss.equals("CE")||ss.equals("C")) //清空<em>操作</em>rn t.setText("");rn rn for(int i=0;i+Double.toString(sum);rn t.setText(dts);rn rn rn public void windowActivated(WindowEvent arg0) rn // TODO 自动生成方法存根rnrn rnrn public void windowClosed(WindowEvent arg0) rn // TODO 自动生成方法存根rnrn rnrn public void windowClosing(WindowEvent e) rn Window ss=(Window)e.getSource();rn ss.setVisible(false);rn ss.dispose();rn rnrn public void windowDeactivated(WindowEvent arg0) rn // TODO 自动生成方法存根rnrn rnrn public void windowDeiconified(WindowEvent arg0) rn // TODO 自动生成方法存根rnrn rnrn public void windowIconified(WindowEvent arg0) rn // TODO 自动生成方法存根rnrn rnrn public void windowOpened(WindowEvent arg0) rn // TODO 自动生成方法存根rnrn rnrnrn我是<em>一个</em>java初学者,做课程设计是遇到了这个问题,精通者帮忙解答一下吧。谢谢!rn这是<em>一个</em>简单计<em>一个</em>算器的设计,我<em>想</em>让它能计算类似a+b*c这样的算式,但是我写了panduan(String s)和metic(String s)函数 感觉挺对的,但在调用函数<em>时</em>怎么抛出异常说字符串s是空的呢???
请教一下这个程序如何改?
#includernusing namespace std;rn typedef struct rnchar data[10];rn int top;rnsqstack;rn rn void initstack(sqstack *&s)rn s=(sqstack *)malloc(sizeof(sqstack));rn s->top=-1;rn rnrn int push(sqstack *& s,char &e)rn if(s->top==9)rn return 0;rns->top++;rn s->data[s->top]=e;rn return 1;rn rnint pop(sqstack*&s,char e)rnif (s->top==-1)rn return 0;rne=s->data[s->top];rns->top--;rnreturn 1;rnrnrnint huiwen(char str[])rnint i;rnchar e;rnsqstack *st;rninitstack(st);rnfor(i=0;str[i]!='\0';i++)rn push(st,str[i]);rnfor(i=0;str[i]!='\0';i++)rnpop(st,e);rnif(str[i]!=e)rnreturn (0);rnrnreturn(1);rnrnint main()rnrn char n,str[10];rn for(int i=0;i>n;rn str[i]=n;rn rn huiwen(str[10]);rn return 0;rnrnrnrnerror C2<em>6</em><em>6</em>4: 'huiwen' : cannot convert parameter 1 from 'char' to 'char []'
这个消息队列的程序怎么这样???!!!!
using System;rnusing System.Drawing;rnusing System.Collections;rnusing System.ComponentModel;rnusing System.Windows.Forms;rnusing System.Data;rnrnnamespace HelpRequestQueuernrnpublic class Form1 : System.Windows.Forms.Formrn rn private System.Messaging.MessageQueue helpRequestQueue;rn private System.Windows.Forms.Label label1;rn private System.Windows.Forms.Label label2;rn private System.Windows.Forms.TextBox txtName;rn private System.Windows.Forms.TextBox txtMessage;rn private System.Windows.Forms.Button sendMessages;rn private System.Windows.Forms.Button refreshMessages;rn private System.Windows.Forms.Button purgeMessages;rn private System.Windows.Forms.CheckBox highPriority;rn private System.Windows.Forms.DataGrid messageGrid;rn private System.ComponentModel.Container components = null;rnrn public Form1()rn 略 /// rn protected override void Dispose( bool disposing )rn 略rnWindows窗体设计器生成的代码(略)rn [STAThread]rn static void Main() rn rn Application.Run(new Form1());rn rn private void refreshMessages_Click(object sender, System.EventArgs e)rn rn display();rn rnprivate void purgeMessages_Click(object sender, System.EventArgs e)rn rn helpRequestQueue.Purge();rn display();rn rnprivate void sendMessages_Click(object sender, System.EventArgs e)rn //就是这里,老提示少个反大括号!!!!!!!!!!!rn private void display()rn rn DataTable messageTable=new DataTable();rn messageTable.Columns.Add("Name");rn messageTable.Columns.Add("Message");rn messageTable.Columns.Add("Priority");rn System.Messaging.Message[] messages;rn messages=helpRequestQueue.GetAllMessages();rn System.Messaging.XmlMessageFormatter stringFormatter;rn stringFormatter=new System.Messaging.XmlMessageFormatter(new string[]"System.String");rn for (int index=0;index
为什么这个程序的结果是这样的?
class ValHold rnpublic int i = 10;rnrnpublic class ObParmrnpublic void amethod()rnValHold v = new ValHold();rnanother(v);rnSystem.out.println(v.i);rnrnpublic void another(ValHold v)rnv.i = 20;rnValHold vh = new ValHold();rnv =vh;rnSystem.out.println(v.i);rnrnpublic static void main(String[] argv)rnObParm o = new ObParm();rno.amethod();rnrn此题的答案是10,20,为什么不是10,10呢? rn
为什么这个程序的结果是这样
#include "string.h"rnmain()rnrn char ch[]="abc",x[3][4]; int i;rn for(i=0;i);rnrnrn运行后的输出结果是 abcbccrnx[i][i]不是只有三个数的吗?怎么出了六个,高手分析下<em>程序</em>,谢谢
这个程序为什么这样输出?
下面这个<em>程序</em>摘自侯捷的泛型<em>程序</em>设计和stl系列文章的第二篇《iterator和traits技术》在gcc2.95.3下编译通过。rn运行<em>时</em>,如果我每输入<em>一个</em>英文字母就回车,我认为屏幕应该这样显示:(数字应为<em>程序</em>自动输出的,字母是我的输入)rn0rnarn1rnbrn2rncrn3rn但是,<em>程序</em>输出却是:rn0rnarnbrncrn这是怎么回事?rn#include rn#include // for ptrdiff_trn#include // for for_each()rn#include // for inserterrn#include rnusing namespace std;rn#include rnclass myistream_line_iterator rnfriend bool operator== (const myistream_line_iterator& x,rnconst myistream_line_iterator& y);rnprotected:rnistream* stream;rnstring value;rnbool end_marker;rnvoid read() rnend_marker = (*stream) ? true : false;rnif (end_marker) getline(*stream, value);rnend_marker = (*stream) ? true : false;rnrnpublic:rntypedef input_iterator_tag iterator_category;rntypedef string value_type;rntypedef ptrdiff_t difference_type;rntypedef const string* pointer;rntypedef const string& reference;rnmyistream_line_iterator() : stream(&cin), end_marker(false) rnmyistream_line_iterator(istream& s) : stream(&s) read(); rnreference operator*() const return value; rnpointer operator->() const return &(operator*()); rnmyistream_line_iterator& operator++() rnread();rnreturn *this;rnrnmyistream_line_iterator operator++(int) rnmyistream_line_iterator tmp = *this;rnread();rnreturn tmp;rnrn;rninline bool operator==(const myistream_line_iterator& x,rnconst myistream_line_iterator& y) rnreturn x.stream == y.stream && x.end_marker == y.end_marker ||rnx.end_marker == false && y.end_marker == false;rnrntemplate rnvoid print_elements(T elem) cout << elem << " "; rnint main()rnrnvector sv;rncout << sv.size() << endl; // 0rnmyistream_line_iterator inputli(cin);rnmyistream_line_iterator eosli;rncopy(inputli, eosli, inserter(sv, sv.begin()));rncout << sv.size() << endl; // [some value!]rnfor(int i=0; i< sv.size(); ++i)rncout << sv[i] << endl;rnrn
求助:如何编写一个可以锁定屏幕的程序,直到输入正确的密码解锁
我需要编写<em>一个</em><em>程序</em>能够<em>锁定</em>屏幕上所有控制包括著名的三键组合,象屏幕保护一样,只有输入正确的<em>密码</em>才<em>解锁</em>屏幕。我应该如何着手,请高人相助。
有这个一个程序
<em>程序</em>启动<em>时</em>按键会在Edit里面显示按键的ASCII码,但是用鼠标点下edit,光标就会停在Edit里面,再按键就没没有ASCII码了rn用鼠标点下<em>窗口</em>以外的地方,再按键又有ASCII码了rn问题是:加点什么代码能使得鼠标在Edit以外<em>窗口</em>以内点下,再按键又可以有ASCII码rn顺便再问下,输出wParam怎么没有Ctrl+Enter的组合码,而只有ASCII码rn[code=C/C++]rn#includern#includernusing namespace std;rn#define IDC_COMBOBOX 100rn#define IDC_EDIT 101rn#define IDC_BUTTON 102rnHWND myedit=0;rnHWND mybutton=0;rnHWND mycombobox=0;rnHWND hwnd=0;rn#pragma comment( linker, "/subsystem:\"windows\" /entry:\"WinMainCRTStartup\"" )rnlong WINAPI WndProc(HWND,UINT,WPARAM,LPARAM);rnint WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpszCmdLine,int nCmdShow)rnrn WNDCLASS wc;rn MSG msg;rnrn wc.style= 0;rn wc.lpfnWndProc=(WNDPROC)WndProc;rn wc.cbClsExtra=0;rn wc.cbWndExtra=0;rn wc.hInstance=hInstance;rn wc.hIcon=LoadIcon(NULL,IDI_WINLOGO);rn wc.hCursor=LoadCursor(NULL,IDC_ARROW);rn wc.hbrBackground=(HBRUSH)(CreateSolidBrush(RGB(0,0,255)));rn wc.lpszMenuName=NULL;rn wc.lpszClassName="MyWndClass";rnrn RegisterClass(&wc);rn hwnd=CreateWindow(rn "MyWndClass",rn "SDK Application",rn WS_SIZEBOX|WS_SYSMENU,rn (GetSystemMetrics(SM_CXSCREEN)-800)/2,rn (GetSystemMetrics(SM_CYSCREEN)-<em>6</em>00)/2,rn 800,rn <em>6</em>00,rn HWND_DESKTOP,rn NULL,rn hInstance,rn NULLrn );rnmycombobox= CreateWindowEx(0,"ComboBox","", WS_VSCROLL|CBS_DROPDOWN|WS_CHILD|WS_OVERLAPPED|WS_VISIBLE, 10,10, 75, 100,hwnd,(HMENU)IDC_COMBOBOX, hInstance, 0);rnmybutton= CreateWindowEx(0,"BUTTON",0,WS_CHILD | WS_VISIBLE, 30,40, 45,45,hwnd,(HMENU)IDC_BUTTON, 0, 0);rnmyedit= CreateWindowEx(0,"Edit", "",ES_READONLY|WS_HSCROLL|WS_VSCROLL|WS_CHILD|ES_MULTILINE|ES_AUTOVSCROLL|WS_BORDER|WS_VISIBLE|ES_NUMBER, 100,100, 150,150,hwnd,(HMENU)IDC_EDIT, hInstance, 0);rnShowWindow(hwnd,SW_SHOW);rnUpdateWindow(hwnd);rnrn while(GetMessage(&msg,NULL,0,0))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rn return msg.wParam;rnrnrnLRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,rn LPARAM lParam)rnrn PAINTSTRUCT ps;rn HDC hdc;rn RECT rect;rn int EditrectX,EditrectY;rn char c[4];rn switch(message)rn rn case WM_PAINT:rn hdc=BeginPaint(hwnd,&ps);rn GetClientRect (hwnd, &rect) ;rn SetBkColor(hdc,RGB(0,255,0));rn SetTextColor(hdc,RGB(255,0,0));rn DrawText (hdc, TEXT ("Hello, Windows 98!"), -1, &rect,DT_SINGLELINE | DT_CENTER | DT_VCENTER);rn Ellipse(hdc,400,100,<em>6</em>00,200);rn EndPaint(hwnd,&ps);rn return 0;rn case WM_KEYDOWN:rn itoa(wParam,c,10);rn SetWindowTextA(myedit,c);rn return 0;rn case WM_COMMAND:rn SendMessage(hwnd,WM_NCACTIVATE,0,0);rn SendMessage(hwnd,WM_CAPTURECHANGED,0,0);rn return 0;rn case WM_DESTROY:rn PostQuitMessage(0);rn return 0;rn rnreturn DefWindowProc(hwnd,message,wParam,lParam);rnrn[/code]
一个这个程序:
问题:运行后,前面两个查找姓与名都运行正确,但是对于salary(薪水)与性别(sex)运行不正确,出<em>现</em>如下错误:rnexpression is not validlrnrnrnstring strrnif sle_1.text<>"" thenrn w_employee.dw_employee.setfilter("emp_id = "+sle_1.text)rnelsern if trim(sle_2.text)<>"" thenrn str="(emp_fname like '" + trim(sle_2.text) +"%')"rn end ifrn if trim(sle_3.text)<>"" thenrn str+="and (emp_lname like '" + trim(sle_3.text) +"%')"rn end ifrn if trim(sle_4.text)<>"" thenrn str+="and (emp_salary >"+trim(sle_4.text)+")"rn end ifrn if trim(sle_5.text)<>"" thenrn str+="and (emp_sex like'"+ trim(sle_5.text) +"%')"rn end ifrn if left(str,3)="and" thenrn str=right(str,len(str)-3)rn end ifrn w_employee.dw_employee.setfilter(str)rnend if rnrn//close(parent)rnrnif w_employee.dw_employee.filter()= - 1 thenrn messagebox("","查询出错")rnend ifrnrnif w_employee.dw_employee.rowcount()=0 thenrn messagebox("","没有找到记录")rnend if
请教】用VB6如何实这个功能
就是有<em>一个</em>COMMAND1,当我点击这个按钮后,系统会对“D:\123\pic”文件夹进行查找,rn如果发<em>现</em>该文件夹下存在名为“abc.jpg”的文件,就会跳出<em>一个</em>MSGBOX告知存在,rn如果没有找到就告知不存在。rnrn就是这个查找的<em>功能</em>,用<em>VB</em><em>6</em>如何实<em>现</em>呢??谢谢各位!!!!!!!!
关闭一个程序
我<em>想</em>在我的<em>程序</em>中间<em>关闭</em>另<em>一个</em><em>程序</em>,比如qq,rn请问用什么函数,是postmessage或者sendmessage吗?我试了好像不可以,不知道是不是什么地方没有设置好.rn还有就是我最近<em>想</em>学api,不知道有没有好的api大全推荐,谢谢
某个文件被其它程序锁定,我如何能知道是哪个程序锁定了这个文件。
我在删除某个文件<em>时</em>,提示文件被<em>锁定</em>,无法删除。我通过什么代码(或函数)能获取到<em>锁定</em>该文件的<em>程序</em>或进程? rnrnrn最好有示例代码。
一个程序,关于关闭这个程序的问题
抱歉,我是<em>一个</em>初学者,提这么简单的问题,不过确实困扰我很久了。。。rnrn我新建了<em>一个</em>对话rnrn上面加了<em>一个</em> BUTTONrnrn我希望达到的效果是 点了BUTTON 以后,<em>程序</em>可以接收键盘输入的字符rnrn如果接收到了键盘输入'q',就<em>关闭</em>自己。。。rnrn请问大家应该如何实<em>现</em>。。。我在BUTTON里面,怎么调用 WM_CHAR??rnrn谢谢……
大家评一下这个程序
http://temp.cxshop.com/
帮我分析这个程序一下
下面是<em>一个</em>“两个数和”的简单的指针<em>程序</em>,但<em>程序</em>出来结果是<em>一个</em>地址,而不是<em>一个</em>数,问题出<em>现</em>在哪里,<em>请教</em>各位帮小弟分析一下,最好有它的运行顺序。谢啦rn#include "stdafx.h"rn#include rnusing namespace std;rnrnint _tmain(int argc, _TCHAR* argv[])rnrn void sum(int *p1,int *p2);rn int *p1,*p2,a,b;rn cin>>a>>b;rn p1=&a;rn p2=&b;rn sum(p1,p2);rn cout<
帮我分析一下这个程序
#includernvoid reverse (char *);rnmain()rnrn char *ps;rn printf("please enter a string:");rn gets(ps);rn reverse(ps);rn // printf("%s\n",ps);rn puts(ps);rnrnvoid reverse (char *q)rnrn int k;char ch,*p;rn k=strlen(q);rn for(p=q+k-1;q
这个程序帮我完善一下!
我写了<em>一个</em>ajax<em>程序</em> 页面上有很多个文本框,但是文本框前面需要<em>一个</em>名字,这些名字都是从数据库中读出来的,页面上是这样的rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn//javascript代码,从后台取数据,数据显示没错,说明不是后台逻辑的问题,<em>现</em>在<em>想</em>每次触发事件的<em>时</em>候清空一下文本框前面的名字rnfunction handleStateChange() rn if(xmlHttp.readyState == 4) rn if(xmlHttp.status == 200) rn clearParemeterList(); rn updateParemeterList();rn rn rnrnfunction updateParemeterList() rn var sa = document.getElementById("spana"); rn var sb = document.getElementById("spanb"); rn var sc = document.getElementById("spanc"); rn var sd = document.getElementById("spand"); rn rn var name = xmlHttp.responseXML.getElementsByTagName("name")[0].firstChild.nodeValue; rn var attr1 = xmlHttp.responseXML.getElementsByTagName("attr1")[0].firstChild.nodeValue; rn var attr2 = xmlHttp.responseXML.getElementsByTagName("attr2")[0].firstChild.nodeValue; rn var attr3 = xmlHttp.responseXML.getElementsByTagName("attr3")[0].firstChild.nodeValue; rnvar spa=document.createElement("h3"); rnvar spb=document.createElement("h3"); rnvar spc=document.createElement("h3"); rnvar spd=document.createElement("h3"); rnvar spatext=document.createTextNode(name); rnvar spbtext=document.createTextNode(attr1); rnvar spctext=document.createTextNode(attr2); rnvar spdtext=document.createTextNode(attr3); rnspa.appendChild(spatext); rnspb.appendChild(spbtext); rnspc.appendChild(spctext); rnspd.appendChild(spdtext); rnsa.appendChild(spa); rnsb.appendChild(spb); rnsc.appendChild(spc); rnsd.appendChild(spd); rn rnfunction clearParemeterList()//这样我自己都觉得不怎么对,但是我怎么每次向后台发<em>一个</em>新请求的<em>时</em>候,都把文本框前面的里面的内容删除呢?rn var table = document.getElementById("tbody");rn while (table.childNodes.length > 0) rn table.removeChild(table.childNodes[0]);rn rnrn
帮忙运行一下这个程序
import org.htmlparser.Parser;rnimport org.htmlparser.visitors.TextExtractingVisitor;rnrnrnpublic static void main(String[] args) throws Exception rn rn Parser parser = new Parser("http://2008.sohu.com/200<em>6</em>0210/n2417<em>6</em>8433.shtml");rn TextExtractingVisitor visitor = new TextExtractingVisitor();rn parser.visitAllNodesWith(visitor);rn System.out.println(visitor.getExtractedText().trim());rn rnrnrn运行结果里还有我不需要的东西,如:rnrnrntd,input,select font-size:12px;color:#000000;rnrn.ui_topcolor:#000000;font-size:12px;line-height:18px;rn.ui_top a:linkcolor:#000000;text-decoration:none;rn.ui_top a:visitedcolor:#000000;text-decoration:none;rn.ui_top a:hover color:#000000;text-decoration:underline;rna.link,a.:visited color: #0071AE;text-decoration:none;line-height:18px;rna.:hovertext-decoration:underline;rnrnrnvar clickCount = 0;rnfunction clearCommentContent(oObject) rn clickCount++;rn if (clickCount == 1) rn oObject.value = "";rn rnrnfunction checkCommentContent(oObject) rn if (clickCount == 0)rn alert("请先填写您的个人看法");rn else if(checkInput() != false)rn oObject.form.submit();rnrnrnrn请问这是为什么?
解析一下这个小程序
double Cylinder(double r,double h);rnvoid main()rnrn double radius,height;rn cout<>radius,height;rn double volume=Cylinder(radius,height);rn cout<<
帮忙分析一下这个程序
首先声明,这个<em>程序</em>不是我自己写的,是从网上找来的,具体是那个网站已经不记得了。rn这是<em>一个</em>俄罗斯方块的<em>程序</em>,用javascript写的,相信很多人可能见过,好了,先下代码:rnrnrn rn rnrn rn rn rn rn rn rn Newrn Pausern rn rnrnrn
测试一下这个程序的运行
请分别用下列选项或编译器编译下面的<em>程序</em>,并分别给出运行<em>时</em>间。rn1. icl /O2 rn2. icl /O2 /Qvec-rn3. cl /O2rnrn参考运行平台:Core 2 Duo CPU, Win Xp, Visual Studio 2005/2008, Intel(R) C++ Compiler 11.1.0<em>6</em>5rnrn我会在一周后给出我的测试结果,大家也可以考虑一下同样的<em>程序</em>在不同的编译器和选项下,运行<em>时</em>间会有多大差别,原因在哪里呢?rnrn// Simple minded matrix multiplyrn#include rn#include rnrn#define NUM 1024rnrnstatic double a[NUM][NUM], b[NUM][NUM], c[NUM][NUM];rnrn//routine to initialize an array with datarnvoid init_arr(double row, double col, double off, double a[][NUM])rnrn int i,j;rnrn for (i=0; i< NUM;i++) rn for (j=0; j
帮忙调试一下这个程序
各位达人,由于小弟没有编译器,故请帮忙调试一下rn1.Fibonacci数列rnrnpublic static int fibonacci(int n)rnrn if (n+j);rn
大家分析一下这个程序
<em>程序</em>作者说是开3389端口的,可是我运行了之后扫描我自己的机器却没有发<em>现</em>我的3389端口<em>打开</em>?rn顺便问一下,3389端口是什么服务?如何实<em>现</em>?rnrnrn#include "windows.h" rn#include "iostream.h" rnrnrnvoid main(int argc, char* argv[]) rn rnHKEY hKey; rnHANDLE hProcess, hToken; rnTOKEN_PRIVILEGES NewState; rnDWORD ProcessId, ReturnLength = 0; rnLUID luidPrivilegeLUID; rnLPCTSTR key[]="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\netcache\\", rn "SOFTWARE\\Policies\\Microsoft\\Windows\\Installer\\", rn "SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\", rn "SYSTEM\\CurrentControlSet\\Services\\TermDD\\", rn "SYSTEM\\CurrentControlSet\\Services\\TermService\\", rn "SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\\", rn ".DEFAULT\\Keyboard Layout\\Toggle\\"; rnHKEY head[]=HKEY_LOCAL_MACHINE, HKEY_LOCAL_MACHINE, rn HKEY_LOCAL_MACHINE,HKEY_LOCAL_MACHINE, rnHKEY_LOCAL_MACHINE,HKEY_LOCAL_MACHINE, rnHKEY_USERS; rnDWORD type[] = REG_DWORD,REG_DWORD,REG_DWORD,REG_DWORD,REG_DWORD,REG_DWORD,REG_SZ; rnLPCTSTR value[] = "\x00\x00\x00\x00", "\x01\x00\x00\x00", "\x01\x00\x00\x00", "\x02\x00\x00\x00", "\x02\x00\x00\x00", "\x3d\x0d\x00\00", "2"; rnDWORD length[] = 4, 4, 4, 4, 4, 4, 2; rnLPCTSTR name[] = "Enabled","EnableAdminTSRemote","TSEnabled","Start","Start","PortNumber","Hotkey"; rnfor(int i = 0; i < 2; i++) rnRegCreateKeyEx(head[i],key[i],0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hKey,NULL); rnfor(i = 0; i < 7; i++) rn rnif(::RegOpenKeyEx(head[i], key[i], 0, KEY_WRITE, &hKey) != ERROR_SUCCESS) rn rncout<<<; rnreturn; rn rnNewState.PrivilegeCount = 1; rnNewState.Privileges[0].Luid = luidPrivilegeLUID; rnNewState.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; rnif(AdjustTokenPrivileges(hToken, FALSE, &NewState, NULL, NULL, NULL)) rnExitWindowsEx(EWX_FORCE | EWX_REBOOT, 0); rnreturn; rn
帮我注释一下这个程序
*已知有<em>一个</em>数组a中顺序存放着<em>一个</em>句有n个元素的线性表,尝试用关键 rn* 字把它们连接成<em>一个</em>带有附加表头结点的循环单链有序表rn*要求:rn*1. 输入n个数据到<em>一个</em>数组中去;rn*2. 输出<em>一个</em>有序序列;rn*3. 用循环单链表结构实<em>现</em>rn<em>使用</em>了快速排序算法rnrnrn#include rn#include rn#include rntypedef struct LNodernrn int data;rn struct LNode *next;rnLNode,*Link, LinkList;rnrnvoid InitLinkListHead(LinkList *pLinkList )rnrn pLinkList->next = pLinkList;rn pLinkList->data = 0xffff; // <em>使用</em>最大整数值作为头的标记rn;rnrnvoid AddNode( LinkList *pLinkList, Link pLink )rnrn Link LNode_temp;rn pLink->next = pLinkList;rn if( pLinkList->next == pLinkList )rn rn pLinkList->next = pLink;rn rn elsern rn LNode_temp = pLinkList->next;rn while( LNode_temp->next != pLinkList )rn rn LNode_temp = LNode_temp->next ;rn rn LNode_temp->next = pLink;rn rnrnrnvoid swap( int *a, int * b )rnrn int temp;rn temp = *a;rn *a = *b;rn *b = temp;rnrnvoid QuickSort( int v[], int left, int right )rnrn int i,last;rn if( left >= right )rn return;rn swap( &v[left],&v[(left+right)/2] );rn last = left;rn for( i = left + 1; i < v[left] )rn swap( &v[++last], &v[i] );rn rn swap( &v[left],&v[last] );rn QuickSort( v, left, last - 1 );rn QuickSort( v, last + 1, right );rnrnrnrnint main()rnrnrn LinkList *p_LinkListHead;rn int i;rn Link Link_temp;rn int arr_data[10];rn Link pLink;rn for( i = 0;i < 10; i++ )rn rn scanf( "%d",&arr_data[i] );rn rnrn p_LinkListHead = ( LinkList*)malloc( sizeof( LinkList ) );rnrn if( NULL == p_LinkListHead )rn rn printf( "LinkList malloc Failure\n" );rn exit( -1 );rn rn InitLinkListHead( p_LinkListHead );rn rnrn QuickSort( arr_data,0,sizeof( arr_data )/sizeof(int) -1 );rn for( i = 0; i < sizeof( arr_data )/sizeof(int); i++ )rn rn Link_temp = (Link)malloc( sizeof( LNode ) );rn if( NULL == Link_temp )rn rn printf( "Link_temp malloc Failuer\n" );rn exit( -i );rn rn Link_temp->data = arr_data[i];rn AddNode( p_LinkListHead,Link_temp );rn rn Link_temp = p_LinkListHead->next;rnrn while( Link_temp != p_LinkListHead )rn rn printf( "%d ",Link_temp->data );rn pLink = Link_temp->next;rn free( Link_temp ); rn Link_temp = pLink;rn rnrn printf( "\n" );rn free( p_LinkListHead );rnrn这个<em>程序</em>是别人写给我的,但我看不懂,请大家在<em>程序</em>边帮我注释一下,讲讲他的思路是什么?谢谢rnrnrn
帮帮忙,讲解一下这个程序
using System;rnrnnamespace SwitchTestrnrn class SwitchTestrn rn [STAThread]rn static void Main(string[] args)rn rn Console.WriteLine("Map size:1=Small 2=Medium 3=Large");rn Console.Write("Please enter your selection:");rn string str=Console.ReadLine(); rn int n=int.Parse(str);rn int cost=0;rn switch(n)rn rn case 1:rn cost=25;rn break;rn case 2:rn cost=50;rn break;rn case 3:rn cost=75;rn break;rn default:rn Console.WriteLine("Invalid input.Please input 1,2,or3.");rn break;rn rn if(cost!=0)rn Console.WriteLine("Please insert0cents.",cost);rn Console.WriteLine("Thank you.");rn rn rnrn哪位高手请帮我写一下这个<em>程序</em>每句代码的意思,谢谢rn
这样的程序功能如何实请教高手
例如<em>一个</em><em>程序</em>运行后,自动弹出<em>一个</em>对话框?rn如何你将弹出对话框的<em>程序</em>放入构造器当中。rn那么<em>程序</em>还没有显示出来。就出<em>现</em>对话框。因为一些原因无法实<em>现</em>静态方法。rn又不能把这些代码写入void main入口。rn还有什么方法使<em>程序</em>完全显示后,弹出对话框。
关闭某个程序
需要<em>一个</em>.bat的文件,在每个礼拜五<em>关闭</em>某个.exe<em>程序</em>。求赐教。。。
问一下,这个程序怎样实
定义打印预览<em>窗口</em> form1;rn 报表<em>窗口</em> form2;rn 调用打印预览的<em>窗口</em> form3;rnrn在<em>程序</em>中怎样调用自定义定义打印预览<em>窗口</em> ,最好能提供一点代码。rn分数少了一点,但是我非常<em>想</em>知道答案,以后有分给您多加一点
怎样实这个程序?高手指点一下
我们的<em>一个</em>实验题目:rn 设数据段有8个字符:rnNUM DB -19,+28,37,-4<em>6</em>,+55,<em>6</em>1,-74,+255rn设计<em>一个</em><em>程序</em>(不是两个<em>程序</em>)完成两项要求:rn1:统计并显示负数的个数。rn2:找出真直最大的数并以十六进制 数显示在屏幕上rnrn我的问题是num 以db储存+255不是 出界了吗rn怎么用循环编这个<em>程序</em>呢?rn+255要不要单处理?
程序关闭再自动启动
我<em>想</em>实<em>现</em>的是,<em>程序</em>运行<em>时</em>,用IF语句判断段某个条件是否达到,如果不达到,那<em>程序</em>自己<em>关闭</em>后再自己重启动,能不能实<em>现</em>?
这个程序有什么功能??
import java.awt.*;rnimport java.awt.event.*;rnclass WindowList extends Frame rnimplements ItemListener,ActionListenerrn List list1,list2; rn TextArea text1,text2; rn int index=0;rn WindowList()rn setLayout(new FlowLayout());rn list1=new List(3,false); rn list2=new List(3,false);rn text1=new TextArea(2,20); rn text2=new TextArea(2,20);rn list1.add("计算1+2+...");rn list1.add("计算1*1+2*2+...");rn list1.add("计算1*1*1+2*2*2+...");rn for(int i=1;i+sum); rn rn rnpublic class Example7_21rn public static void main(String args[])rn new WindowList(); rn rnrn为什么list1中的选项要单击,而list2中的选项要双击才行啊????rn百思不的其解
帮我看看这个程序功能
这是个串口通信中的子过程,但是<em>功能</em>不明。rnrnprocedure GetData(portn: integer; str: pchar);//portn: COM号 rnvarrn rec_temp:byte;rn time_start,time_end:TDateTime;rnbeginrn time_start:=now;rn repeat rec_temp:=sio_iqueue(portn);//rn time_end:=now;rn if time_end-time_start>0.0000057 then//这个地方不理解rn beginrn application.MessageBox(str,'出错提示框',0);rn beep();rn exit;rn end;rn until rec_temp>0;rnend;
怎样用程序解决这个功能
<em>一个</em>Excel的Sheet,有N行。rn如果这些行的第一列包含“合计”文本,则将整个行设成黄色,rn如果这些行的第一列不包含“合计”文本,则不做任何改动。
这个功能程序怎么写?
两个文本框,<em>一个</em>确定按扭.后台有<em>一个</em>用ACCESS建的叫info.mdb的数据库,包括一张用户资料表,两个字段,用户名,<em>密码</em>,假定有一条记录,用户名:lewi,<em>密码</em>:111rn<em>现</em>要求在第<em>一个</em>文本匡里写lewi,点确定,<em>密码</em>111出<em>现</em>在第二个文本匡.rn要求:不能用控件,用记录集,连接集之类通过编程实<em>现</em>,通过ADO方式访问ODBC实<em>现</em>.rn假定目录如下:d/info.mdb.sub main 函树写在哪?是在窗体还是模块?
怎么判断已打开某个程序
要做到了不能<em>打开</em>两个相同的软件。谢谢各位高手相助。
这个程序中的问题?
有<em>一个</em>分数序列:2/1,3/2,5/3,8/5,13/8,21/13……rn编程求这个序列的前20项之和。rnmain()rnrn int i,t,n=20;rn [color=#FF0000] float a=2,b=1,s=0;[/color]rnfor(i=1;i,s);rnrnrn这个题目将a和b定义为float,如果定义为int的话,我试了,会出错,原因是什么?求大神指教
基于HTML5+CSS3实现的简易版俄罗斯方块游戏源码下载
这是一款基于HTML5/CSS3制作的俄罗斯方块游戏,这款游戏相对简易,外观简介,功能齐全,具有俄罗斯方块的移动、翻转及消除等基本的功能,通过对这款游戏源码的学习可以很大程度上帮助我们提高HTML5游戏开发的技巧,并对HTML5有更深入的认识 相关下载链接:[url=//download.csdn.net/download/su_xiaoyan/7972543?utm_source=bbsseo]//download.csdn.net/download/su_xiaoyan/7972543?utm_source=bbsseo[/url]
python程序员指南下载
python程序员指南,python是一门很好的语言,所有需要一本好书 相关下载链接:[url=//download.csdn.net/download/mslmitt/2014204?utm_source=bbsseo]//download.csdn.net/download/mslmitt/2014204?utm_source=bbsseo[/url]
在matlab中对图像或视频信息的获取代码下载
在matlab中对图像或视频信息的获取代码 相关下载链接:[url=//download.csdn.net/download/xiaowei19870119/3031392?utm_source=bbsseo]//download.csdn.net/download/xiaowei19870119/3031392?utm_source=bbsseo[/url]
相关热词 c# 线程结束时执行 c# kb mb 图片 c# 替换第几位字符 c#项目决定成败 c# 与matlab c# xml缩进 c#传感器基础 c#操作wps c# md5使用方法 c# 引用父窗口的组件
我们是很有底线的