java菜鸟一枚希望大神可以帮我改一下代码。代码除了问题但是没有报错。

package com.sosee;

import java.util.Scanner;

import com.sosee.lvc;

public class lvc {

public boolean isLeapYear(int year) {
    boolean isLeap = false;
    calcLeapYear();

if (year%4!=0) {
         isLeap=false;
         System.out.println("该年不是闰年"+year);}

else if(year%400!=0&&year%100==0)
{
isLeap=false;
System.out.println("该年不是闰年"+year);}
if (year % 4 == 0 && year % 100 != 0) {

isLeap = true;

System.out.println("该年是闰年"+year);
} else if (year % 400 == 0) {

isLeap = true;

System.out.println("该年是闰年"+year);
}

return isLeap;

}
public void calcLeapYear() {

    Scanner sc=new  Scanner(System.in);

    int[] year=new int[5];
    for(int i=0;i<year.length;i++) {
        System.out.println("请输入5个年份:");

        year[i]=sc.nextInt();
    }

    sc.close();


    }

public static void main(String[] args) {
lvc studentMange=new lvc();
studentMange.calcLeapYear();

studentMange.calcLeapYear();

}
}

0

4个回答

你这个代码问题很多。1、单独写了一个方法calcLeapYear(),并且在isLeapYear(int year)方法里面调用了这个方法,但是你没有发现你在
计算闰年的过程中全程没有用到calcLeapYear()这个方法中输入的年份。2、主方法调用的方法是calcLeapYear(),这个方法只是用来获取
输入的年份,你要计算年份是不是闰年不是应该调用isLeapYear(int year)这个方法吗?
以下是修改过的代码
public class lvc {
public static void main(String[] args) {
lvc studentMange=new lvc();
studentMange.isLeapYear(2020);

    //studentMange.calcLeapYear();
    }

public boolean isLeapYear(int year) {
boolean isLeap = false;
calcLeapYear();

if (year%4!=0) {
     isLeap=false;
     System.out.println("该年不是闰年"+year);
     }
else if(year%400!=0&&year%100==0){
    isLeap=false;
    System.out.println("该年不是闰年"+year);
    }


if (year % 4 == 0 && year % 100 != 0) {

    isLeap = true;

    System.out.println("该年是闰年"+year);
} else if (year % 400 == 0) {

    isLeap = true;

    System.out.println("该年是闰年"+year);
}

return isLeap;

}

public void calcLeapYear() {

Scanner sc=new  Scanner(System.in);
int[] year=new int[5];
for(int i=0;i<year.length;i++) {
    System.out.println("请输入"+(5-i)+"个年份:");
   year[i]=sc.nextInt();
}
sc.close();

}
}

0

isLeapYear(int year)这个方法没看见被调用呢

1

你这个要干嘛我都不知道 你要判断的话就调用isLeapYear ,你要遍历你输入的5个年份那就遍历传参不就行了。。

1

试试调用isLeapYear

1
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
帮我改一下代码
网站LOGO位置不正确,上面有空的地方,图片变大就显示传位了,www.huolinhe.com 哪位高手帮忙修改一下rnrn rn rn rn rn rn rn rn 用户名:rn 密码:rn rn 忘记密码?rn 注册rn rn rn rn rn rn rn rn 站内搜索 | 网站地图 | 设为首页 | 加入收藏rn rn rnrn rn rn rnrn rn rn 首页 rn dir:category parentid="$catid" row="8" mod="1" type="top"rn code $childrenid=get_childrencatid(mydc:id);rn mydc:catnamern /dir:categoryrn rnrn rn rnrn rn rn rn 大家都在搜:hotkeywords('weight',6)rn rn
帮我改一下代码!!
<% rn// 处理留言信息程序rnint CurPage,CurPageSize,allRecordCount;rnCurPage = int.Parse(lblCurPage.Text);rnCurPageSize = int.Parse(lblPageSize.Text);rnallRecordCount = int.Parse(lblCurRecord.Text);rnif (allRecordCount == 0)rn Response.Write(" 当前你还没有留言");rn rnelsern string connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source="+Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["数据库"].ToString());rn string SQLStr = "SELECT * FROM [admin] ORDER BY [时间]DESC"; // 当改为多用户时,在这里设置 WHERE 条件即可rn System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connStr);rn System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(SQLStr,conn);rn System.Data.DataSet ds = new System.Data.DataSet();rn conn.Open();rn da.Fill(ds,(CurPage-1)*CurPageSize,CurPageSize,"admin");rn conn.Close();rn conn.Dispose();rn da.Dispose();rn for (int i=0 ; i< ds.Tables[0].Rows.Count ; i++)rn%>rn <% Response.Write(ds.Tables[0].Rows[i]["呢称"]); %>rn rn这是C#的留言板,请问怎样把它改成VB的,这是在aspx页面里<%%>的代码怎样改.
>>请帮我改一下代码?<<
我想根据条件,在GRID显示合条件的记录??rnrnthisform.GRid1.RecordSource =''rnIF !USED('proinfo')rn USE proinforn ENDIFrn rnselect proinfornrninarea=ALLTRIM(thisform.text1.Value)rnrnif proinfo.pro_agent != inarearn go toprn messagebox('没有记录存在,请重请查找',48,'信息窗口')rn thisform.GRid1.RecordSource='proinfo'rn Thisform.text1.Value=''rn Thisform.text1.SetFocus rnelsernrn thisform.GRid1.RecordSource='proinfo'rn thisform.GRid1.refreshrnrnendifrnrn谢谢!rn
帮我改一下这个代码。。
[code=text]rnresponse.Write("[")rnIF Not rstur.Bof And Not rstur.Eof Thenrni=1rnDo Until rstur.EOF OR i=harbatta+1rnresponse.Write("""id"":"""&rstur("id")&""",""title"":"""&rstur("name")&""",""updatetime"":"""&FormatDate(rstur("add"),3)&""",")rnrstur.movenextrni=i+1rnlooprnresponse.Write("]")rn[/code]rnrn显示这样。。 但是ajax 错误。。。。rn[code=text]rn["id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25","id":"245","title":"标题","updatetime":"09-25",]rn[/code]rnrn[size=18px]怎么去掉最后的 ] 前面的 , 帮我。。[/size] rnrn
帮我改一下连接池代码
帮我把下面的连接池代码改一下,rn我想在连接数达到maxConn时,再从连接池获取连接时,就把正在使用的第一个连接(使用最长的那个)拿去用。rnrnpackage com.aaa.db;rnrnrnimport java.io.*;rnimport java.sql.*;rnimport java.util.*;rnimport java.util.Date;rnrn/**rn* 管理类DBConnectionManager支持对一个或多个由属性文件定义的数据库连接rn* 池的访问.客户程序可以调用getInstance()方法访问本类的唯一实例.rn*/rnpublic class DBConnectionManager rn static private DBConnectionManager instance; // 唯一实例rn static private int clients;rnrn private Vector drivers = new Vector();rn private PrintWriter log;rn private Hashtable pools = new Hashtable();rn /**rn * 返回唯一实例.如果是第一次调用此方法,则创建实例rn *rn * @return DBConnectionManager 唯一实例rn */rn static synchronized public DBConnectionManager getInstance() rn if (instance == null) rn instance = new DBConnectionManager();rn rn clients++;rn return instance;rn rnrn /**rn * 建构函数私有以防止其它对象创建本类实例rn */rn private DBConnectionManager() rn init();rn rnrn /**rn * 将连接对象返回给由名字指定的连接池rn *rn * @param name 在属性文件中定义的连接池名字rn * @param con 连接对象rn */rn public void freeConnection(String name, Connection con) rn DBConnectionPool pool = (DBConnectionPool) pools.get(name);rn if (pool != null) rn if (con!=null)rn tryrn rn pool.freeConnection(con);rn System.out.println("Free Conn:" + con.toString());rn System.out.println("Current Free Connection in pool " + name + ":" +rn getFrees(name));rn System.out.println("Current Inuse Connection in pool " + name + ":" +rn getInuses(name));rn catch(NullPointerException ex)rn rn System.out.println("UCBBS System Free Conn ERROR!");rn rn rn rn rnrn /**rn * 获得一个可用的(空闲的)连接.如果没有可用连接,且已有连接数小于最大连接数rn * 限制,则创建并返回新连接rn *rn * @param name 在属性文件中定义的连接池名字rn * @return Connection 可用连接或nullrn */rn public Connection getConnection(String name) rn DBConnectionPool pool = (DBConnectionPool) pools.get(name);rn if (pool != null) rn return pool.getConnection();rn rn return null;rn rnrn /**rn * 获得一个可用连接.若没有可用连接,且已有连接数小于最大连接数限制,rn * 则创建并返回新连接.否则,在指定的时间内等待其它线程释放连接.rn *rn * @param name 连接池名字rn * @param time 以毫秒计的等待时间rn * @return Connection 可用连接或nullrn */rn public Connection getConnection(String name, long time) rn DBConnectionPool pool = (DBConnectionPool) pools.get(name);rn if (pool != null) rn return pool.getConnection(time);rn rn return null;rn rn /**rn * 将文本信息写入日志文件rn */rn private void log(String msg) rn log.println(new Date() + ": " + msg);rn rn /**rn * 将文本信息与异常写入日志文件rn */rn private void log(Throwable e, String msg) rn log.println(new Date() + ": " + msg);rn e.printStackTrace(log);rn rnrn /**rn *重至某个连接池rn */rn public void resetPool(String name) rn DBConnectionPool pool = (DBConnectionPool) pools.get(name);rn if (pool != null) rn pool.release() ;rn rn rnrn /**rn *得到现有的空连接数rn */rn public int getFrees(String name)rn DBConnectionPool pool = (DBConnectionPool) pools.get(name);rn if (pool != null) rn return pool.getFrees() ;rn rn return -1 ;rn rnrn /**rn *得到当前正在使用的连接数rn */rn public int getInuses(String name)rn DBConnectionPool pool = (DBConnectionPool) pools.get(name);rn if (pool != null) rn return pool.getInuses() ;rn rn return -1 ;rn rnrn /**rn * 关闭所有连接,撤销驱动程序的注册rn */rn public synchronized void release() rn // 等待直到最后一个客户程序调用rn if (--clients != 0) rn return;rn rn Enumeration allPools = pools.elements();rn while (allPools.hasMoreElements()) rn DBConnectionPool pool = (DBConnectionPool) allPools.nextElement();rn pool.release();rn rn Enumeration allDrivers = drivers.elements();rn while (allDrivers.hasMoreElements()) rn Driver driver = (Driver) allDrivers.nextElement();rn try rn DriverManager.deregisterDriver(driver);rn log("撤销JDBC驱动程序 " + driver.getClass().getName()+"的注册");rn rn catch (SQLException e) rn log(e, "无法撤销下列JDBC驱动程序的注册: " + driver.getClass().getName());rn rn rn rnrn
大家帮我改一下代码
功能是做一个排行榜,如果标题长度大于10就取子串,后面加…rn我写的这个怎么去不准阿,而且都加…rnrn<%rndim strrnstr=len(rs("softName"))rnif str>10 thenrnresponse.Write left(rs("softName"),10)&"…"rnelse response.Write rs("softName")rnend ifrn%>rnrn谢谢各位啦
求大神,菜鸟一枚
ResultInfo resultInfo = new ResultInfo();rn resultInfo.setMessage("未执行");rn导入Excel sheet生成凭证的时候的代码 ,不懂什么意思
菜鸟一枚,大神帮忙
[code=html]rn rn[/code]rn在火狐浏览器里 不显示默认图片,该怎么处理(ie 显示)?
大神帮我改一下while循环
/*十进制转换为二进制*/rn#includernrnint main()rnrn int n,r,t,k=0,x;rn int a[1000];rn printf("请输入一个十进制整数:");rn scanf("%d",&n);rn while(x!=1)rn rn r=n%2;rn x=n/2;rn a[k++]=r;rn t=x;x=t;t=n;rn rn printf("转换为二进制:");rn for(int i=0;i
求大神改代码!!!!
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>n<%@page import="util.Info"%>n<%@page import="dao.CommDAO"%>n<%@page import="util.PageManager"%>nn n 话题信息n n n nnn n 已有话题信息列表:n n 搜索: 标题:n nnn list = PageManager.getPages(url,15,sql, request); n int i=0;n for(HashMap map:list) n i++;n n nnn %>n n n 序号n 标题n n 添加人n n 评论管理n 添加时间n n 操作n n <% n nnn new CommDAO().delete(request,"huatixinxi"); n String url = "huatixinxi_list.jsp?1=1"; n String sql = "select * from huatixinxi where 1=1";n nif(request.getParameter("biaoti")=="" ||request.getParameter("biaoti")==null )elsesql=sql+" and biaoti like '%"+request.getParameter("biaoti")+"%'";n sql+=" order by id desc";n ArrayList n <%=i %>n <%=map.get("biaoti") %>n n <%=map.get("tianjiaren") %>n n &biao=huatixinxi">评论管理n <%=map.get("addtime") %>n " onClick="return confirm('真的要删除?')">删除 ">详细 n n <%n n %>nn n n$page.info nnn nnn删除那加一个判断语句,如果是‘’超级管理员‘’执行删除,否则提示“您没有此权限”n这是我自己 弄得不行,可以参考一下:n<% request.getSession().getAttribute("cx").equals("管理员"))%>" onClick="return confirm('真的要删除?')">删除 <%%>n我不懂写代码,最好能给我对的能实现的代码,谢谢。
改代码保存报错
在jsp中改代码,保存的时候报错 Save Failed Compilation unit name must end with .java, or one of the registered Java-like extensions 查找后发现去掉断点就可以保存了
我是菜鸟,希望牛人帮我优化一下代码
/* 输出 1rn * 333rn * 55555rn * 7777777rn * 999999999rn * 7777777rn * 55555rn * 333rn * 1 */rn#include rn#define line 5rnint main(void)rnrn int i,j,k,a,b,c;rn for(i=1;i<=line;i++)rn rn rn for(j=1;j<=line-i;j++)rn printf(" ");rn for(k=1;k<=2*i-1;k++)rn printf("%d",2*i-1);rn rn printf("\n");rn rn for(a=line-1;a>=1;a--)rn rn rn for(b=1;b<=line-a;b++)rn printf(" ");rn for(c=2*a-1;c>=1;c--)rn printf("%d",2*a-1);rn rn printf("\n");rn rn return 0;rn
大家帮我改一下这个删除代码
rn<%rnif session("userid")="" thenrn%>rn rn<%rnresponse.write" 对不起,您还没有登录,不能修改会员资料,请返回首页登录后再行修改!"rn%>rn<%rnresponse.endrnend ifrndim rsrnset rs=server.CreateObject("ADODB.RecordSet")rnif request("yes") <>"yes" thenrnsql="delete from [user] where id="&request("id")rnset rs=conn.Execute(sql)rnrs.closernset rs=nothingrnconn.closernset conn=nothingrnresponse.write" "rnend ifrnrnresponse.write(" 确定要注销账号吗? | 不删除")rn%>rn这是源码,但运行时总是提示set rs=conn.Execute(sql)这句出错,我把它改成了conn.Execute(sql),也一样,到底怎样写才对呢?大家帮我一下好吗?
谁能帮我改一下这段代码?
[code=VB]rn'----------------------------------------------------- rn1、引用Microsft activex data objects 2.0 library rn2、添加数据时没有对表内相同的商品名进行判断 rn3、如果数据存在相同的商品名时只显示第一条记录 rn4、txtq代表您的表名 rn5、ID的数据类型为numeric rn6、数据库为SQL2000 rn'----------------------------------------------------- rnPrivate Sub Combo1_Click() rnSet conn = New ADODB.Connection rnSet rs = New ADODB.Recordset rnconn.ConnectionString = "Driver=sql server;server=AA;uid=sa;pwd=;database=BB" 'AA代表连接服务器名称或IP,BB代表连接数据库名 rnconn.ConnectionTimeout = 20 rnconn.Open rnrs.Open "select * from [txtq] where (商品名='" & Trim(Combo1.Text) & "')", conn, adOpenStatic, adLockReadOnly, adCmdText rnIf rs.EOF = True And rs.BOF Then rnElse rnrs.MoveFirst rnText1.Text = rs.Fields(2) rnText2.Text = rs.Fields(3) rnText3.Text = rs.Fields(4) rnText4.Text = rs.Fields(5) rnText5.Text = rs.Fields(6) rnrs.Close rnconn.Close rn Set rs = Nothing rn Set conn = Nothing rnEnd If rnEnd Sub rnPrivate Sub Command1_Click() '添加 rnSet conn = New ADODB.Connection rnSet rs = New ADODB.Recordset rnconn.ConnectionString = "Driver=sql server;server=AA;uid=sa;pwd=;database=BB" 'AA代表连接服务器名称或IP,BB代表连接数据库名 rnconn.ConnectionTimeout = 20 rnconn.Open rnrs.Open "select * from [txtq]", conn, adOpenKeyset, adLockOptimistic, adCmdText rnrs.AddNew rnrs.Fields(1) = Trim(Combo1.Text) rnrs.Fields(2) = Trim(Text1.Text) rnrs.Fields(3) = Trim(Text2.Text) rnrs.Fields(4) = Trim(Text3.Text) rnrs.Fields(5) = Trim(Text4.Text) rnrs.Fields(6) = Trim(Text5.Text) rnrs.Update rnrs.Close rn Set rs = Nothing rn Set conn = Nothing rnUnload Me rnMsgBox "增加成功", vbInformation, "提示" rnMe.Show rnEnd Sub rnPrivate Sub Command2_Click() '删除 rnSet conn = New ADODB.Connection rnSet rs = New ADODB.Recordset rnIf Trim(Combo1.Text) = "" Then rnExit Sub rnEnd If rnDim SureQ As Integer rnSureQ = MsgBox("您真的要删除商品名为" & Trim(Combo1.Text) & " 的记录吗?", vbYesNo + 32, "提示") rnIf SureQ = 6 Then rnCancel = 0 rnconn.ConnectionString = "Driver=sql server;server=AA;uid=sa;pwd=;database=BB" 'AA代表连接服务器名称或IP,BB代表连接数据库名 rnconn.ConnectionTimeout = 20 rnconn.Open rnrs.Open "delete from [txtq] where (商品名='" & Trim(Combo1.Text) & "')", conn, adOpenKeyset, adLockOptimistic, adCmdText rnconn.Close rnSet rs = Nothing rnSet conn = Nothing rnUnload Me rnMsgBox "删除成功", vbInformation, "提示" rnMe.Show rnElse rn Cancel = -1 rn End If rnEnd Sub rnPrivate Sub Form_Load() rnSet conn = New ADODB.Connection rnSet rs = New ADODB.Recordset rnSet mrc = New ADODB.Recordset rnconn.ConnectionString = "Driver=sql server;server=AA;uid=sa;pwd=;database=BB" 'AA代表连接服务器名称或IP,BB代表连接数据库名 rnconn.ConnectionTimeout = 20 rnconn.Open rnmrc.Open "select Count(商品名) AS lCount,商品名 from [txtq] group by 商品名 order by 商品名", conn, adOpenStatic, adLockReadOnly, adCmdText rnIf mrc.EOF = True And mrc.BOF Then rnElse rnDo Until mrc.EOF rn strUserName = mrc("商品名") rn Combo1.AddItem strUserName rn mrc.MoveNext rn Loop rn mrc.Close rnEnd If rnrs.Open "select ID from [txtq] order by ID", conn, adOpenStatic, adLockReadOnly, adCmdText rnIf rs.EOF = True And rs.BOF Then rnLabel2.Caption = 1 rnElse rnLabel2.Caption = rs.Fields(0) + 1 rnEnd If rnrs.Close rnSet rs = Nothing rnSet mrc = Nothing rnSet conn = Nothing rnEnd Sub rnrn[/code]rnrn改成本地数据库的!而且为什么我现在这样运行会出错的啊?rn运行了它说我用户定义类型未定义?rnNew ADODB.Connection
求达人帮我改一下这段代码
[code=VB]rnstrSourceFile = Server.MapPath("091201.xml")rnSet objXML = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")rnobjXML.load(strSourceFile)rnSet objRootsite = objXML.documentElement.selectSingleNode("图书商品")rnnum=objRootsite.childNodes.length-1rnFor i=0 To numrnresponse.write objRootsite.selectSingleNode("商品代码").text&" "rnresponse.write objRootsite.selectSingleNode("供货商商品ID").text&" "rnresponse.write objRootsite.selectSingleNode("书名").text&" "rnresponse.write objRootsite.selectSingleNode("定价").text&" "rnnextrn[/code]rnrnrn循环指定节点的xml文档内容。rn上面这段代码中只能循环出第一条“图书商品”节点下的内容,后面还有好多条不同的,但不知道怎么写才能循环出后面的,现在的原因似乎是数据指针没有往下移动。求解决方法。。rnrn
谁帮我改一下这个代码!谢谢
var stmp_a = "";rnfunction strTrans_a(strT)rnrn if(strT.value==stmp_a) return;rn var ms = strT.value.replace(/[^\d\.]/g,"").replace(/(\.\d3).+$/,"$1");//验证用户的输入rn var txt = ms.split("."); //分割成数组rn while(/\d4(,|$)/.test(txt[0]))rn txt[0] = txt[0].replace(/(\d)(\d3(,|$))/,"$1,$2"); //科学计数法表示形式rn strT.value = stmp_a = txt[0]+(txt.length>1?"."+txt[1]:"");rnrnrnrn这个代码是显示 数字的代码rn但他有个功能就是整数以前的数,每隔三个数就会出现一个 逗号,我想不让他显示逗号rn应该改哪里啊!谢谢
专家能帮我改一下代码吗
想做一个按键命令Command1rnp = Len(Text1.Text)rnfor i =1 to prn for j=i +1 to p rn for k=j +1 to prn print i*100+j*10+k rn next k rn next j rnnext irn我在文本框输入大于3为数的数字,然后他进行排列,可是他是按照1-p的方式排列的,不是按照所输入数字排列的,比如说在文本框输入了3456,他还是从1排列,并不是按照每位的数字排列的,这个我明白因为p是代表这个数有几位数字当然要从1的排序开始到4结束,而不是从数字的第一位数字开始,请高手帮忙给更改一下,要取3456每位数而不是取1234,p要求最多10位,而且所输入数字不能有重复,也就是最多为0-9,并且要把计算结果显示在listbox中,这个代码该如何改,谢谢 rn
请帮我改一下这段代码
if DataModule1.ADOTable1.Locate('LIBNO',edit1.text,[lopartialkey]) thenrn beginrn showmessage('这个编号已经存');rn Edit1.SetFocus;rn Exit;rn end;rn if DataModule1.ADOTable1.locate('DESC',edit2.text,[lopartialkey]) thenrn beginrn showmessage('这个名称已经存');rn Edit2.SetFocus;rn Exit;rn end;rnrn当一执行到第二个IF 语句时出错,请问应该怎样写
请帮我改一下代码谢谢!
该段代码实现从系统管理中找到提交申请者的上级单位领导,并给他发送文档连接,这是C/S模式下的一个操作,我想把他该为B/S模式下的 代理,我是一个新手特别是对WEB下的代理不熟,请教各位大侠帮帮忙其中以dept开头的是视图,以sq开头的是域rnrnDim session As New notessessionrn Dim dbs As notesdatabasern Dim ser_name As Stringrn Dim user As Stringrn Dim dept As Stringrn rn Set dbs=session.currentdatabasern ser_name=dbs.serverrn user=session.CommonUserNamern rn Dim db As New notesdatabase(ser_name,"oa\sysadmin")rn Dim view As notesviewrn Dim doc As notesdocumentrn Dim item As notesitemrn rn Dim workspace As New notesUIWorkspacern Dim uidoc As notesUIDocumentrn Set uidoc=workspace.CurrentDocumentrn rn If uidoc.fieldgettext("sp_pro")="缺省程序" Then rn rn Set view=db.getview("按姓名查询") rn Set doc=view.getdocumentbykey(user+"/"+Strright(ser_name,"/O="))rn rn Set item=doc.getfirstitem("ifleader")rn leader=item.text '单位领导rn Set item=doc.getfirstitem("dept_f")rn f_d=item.textrn Set item=doc.getfirstitem("dept_second")rn f_s=item.textrn Set item=doc.getfirstitem("dept_third")rn f_t=item.textrn Set item=doc.getfirstitem("dept_fourth")rn f_ft=item.textrn Set item=doc.getfirstitem("上级单位")rn up_dept=item.textrn rn If f_s="--" Then rn dept=f_drn Elsern If f_t="--" Thenrn dept=f_d & f_srn Elsern If f_ft="--" Thenrn dept=f_d & f_s & f_trn Elsern dept=f_d & f_s & f_t & f_ftrn End Ifrn End Ifrn End Ifrn rn If leader="是" Then '如果当前操作人是本部门领导rn Set view=db.getview("(depart_class)") rn Set doc=view.getdocumentbykey(dept)rn If Not(doc Is Nothing) Thenrn Set item=doc.getfirstitem("up_class")rn up_c=item.text '当前部门的上级部门rn Elsern Messagebox "没找到相应的文档"rn End Ifrn If up_c="无" Then rn Messagebox "到达系统组织机构的顶级,不再在上报了!"rn Elsern Set view=db.getview("(dept_person)")rn Set doc=view.getfirstdocumentrn found=Falsern While Not(doc Is Nothing) And Not found '查找部门领导rn Set item=doc.getfirstitem("ifleader")rn if_l=item.textrn Set item=doc.getfirstitem("单位全称")rn full_name=item.textrn If (full_name=up_c And if_l="是") Then rn Set item=doc.getfirstitem("person_name")rn sent_person=item.textrn found=Truern Elsern Set doc=view.getnextdocument(doc)rn End Ifrn Wendrn If Not found Then '该部门不存在部门领导 rn Messagebox("上级部门: "+up_ct+" 没有设定部门领导,请与系统管理员联系")rn Elsern allowedit=Truern uidoc.editmode=Truern rn Call uidoc.fieldsettext("sq_status","上传")rn Call uidoc.fieldsettext("sq_temp2",uidoc.fieldgettext("sq_temp1"))rn Call uidoc.fieldsettext("sq_temp1",uidoc.fieldgettext("sq_from"))rn Call uidoc.fieldsettext("sq_from",user)rn Call uidoc.fieldsettext("sq_handle",sent_person)rn Call uidoc.save()rn allowedit=Falsern uidoc.editmode=Falsern rn '发送邮件rn Set doc = uidoc.documentrn Dim newdoc As notesdocumentrn Dim rtitem As notesrichtextitemrn Set newdoc = New notesdocument(dbs)rn Set rtitem = New notesrichtextitem(newdoc,"body") rn Call rtitem.appenddoclink(doc,"申请")rn newdoc.subject =user +"于 "+Cstr(Today())+" 报给你一份申请,请你抓紧时间处理"rn Call rtitem.appendtext(" 请办理!") rn newdoc.sendto = sent_personrn newdoc.send(False)rn Call uidoc.close()rn End Ifrn rn End Ifrn Else '当前操作人员不是部门领导rn Set view=db.getview("(dept_person)")rn Set doc=view.getfirstdocumentrn found=Falsern While Not(doc Is Nothing) And Not found '查找本部门领导rn Set item=doc.getfirstitem("ifleader")rn if_l=item.textrn Set item=doc.getfirstitem("单位全称")rn full_name=item.textrn If (full_name=dept And if_l="是") Then rn Set item=doc.getfirstitem("person_name")rn sent_person=item.textrn found=Truern Elsern Set doc=view.getnextdocument(doc)rn End Ifrn Wendrn If Not found Then '该部门不存在部门领导 rn Messagebox("本部门: "+dept+" 没有设定部门领导,请与系统管理员联系")rn Else '发送信件通知相关人员处理来文rn allowedit=Truern uidoc.editmode=Truern rn Call uidoc.fieldsettext("sq_status","上传")rn Call uidoc.fieldsettext("sq_temp2",uidoc.fieldgettext("sq_temp1"))rn Call uidoc.fieldsettext("sq_temp1",uidoc.fieldgettext("sq_from"))rn Call uidoc.fieldsettext("sq_from",user)rn Call uidoc.fieldsettext("sq_handle",sent_person)rn Call uidoc.save()rn allowedit=Falsern uidoc.editmode=Falsern '发送邮件rn Set doc1 = uidoc.documentrn Dim newdoc1 As notesdocumentrn Dim rtitem1 As notesrichtextitemrn Set newdoc1 = New notesdocument(dbs)rn Set rtitem1 = New notesrichtextitem(newdoc1,"body") rn Call rtitem1.appenddoclink(doc1,"申请")rn newdoc.subject =user +"于 "+Cstr(Today())+" 报给你一份申请,请你抓紧时间处理"rn Call rtitem.appendtext(" 请办理!") rn newdoc.sendto = sent_personrn newdoc.send(False)rn Call uidoc.close()rn End Ifrn End If rn Elsern sent_person=uidoc.fieldgettext("manual_person")rn If sent_person="" Thenrn Messagebox "你使用了自定义审批程序,但是没有指定审批人!"rn Elsern rn allowedit=Truern uidoc.editmode=Truern rn Call uidoc.fieldsettext("sq_status","上传")rn Call uidoc.fieldsettext("sq_temp2",uidoc.fieldgettext("sq_temp1"))rn Call uidoc.fieldsettext("sq_temp1",uidoc.fieldgettext("sq_from"))rn Call uidoc.fieldsettext("sq_from",user)rn Call uidoc.fieldsettext("sq_handle",sent_person)rn Call uidoc.save()rn allowedit=Falsern uidoc.editmode=Falsern Dim dbmail3 As NotesDatabasern Dim docmail3 As NotesDocumentrn Set dbmail3 = session.CurrentDatabasern Set docmail3 = New NotesDocument( dbmail3)rn docmail3.SendTo = sent_personrn docmail3.Subject =user +"于 "+Cstr(Today())+" 报给你一份申请,请你抓紧时间处理"rn docmail3.body=" 请在本系统的申请审批-待办审批中打开该文件"rn Call docmail3.Send( False )rn Call uidoc.close()rn rn End Ifrn End Ifrn rn
谁帮我改一下下面这段代码?
谁帮我改一下下面这段代码rn//test.htmlrnrnrn Untitled Documentrn rnrnrn rnrnrnrn//js.htmrndocument.write('rn rn rn 30兆CGI空间rn rnrn')rnrn运行是时提示行document.write('未结束的字符串常量
帮我改一下图片显示不对称代码
网站LOGO图片上面有空闲地方,图片一大的时候显示不正常,www.huolinhe.com 帮我看一下怎么修改下面的代码rnrnrnrn rn rn rn rn rn rn rn 用户名:rn 密码:rn rn 忘记密码?rn 注册rn rn rn rn rn rn rn rn 站内搜索 | 网站地图 | 设为首页 | 加入收藏rn rn rnrn rn rn rnrn rn rn 首页 rn dir:category parentid="$catid" row="8" mod="1" type="top"rn code $childrenid=get_childrencatid(mydc:id);rn mydc:catnamern /dir:categoryrn rnrn rn rnrn rn rn rn 大家都在搜:hotkeywords('weight',6)rn rn
这是一段代码 麻烦帮我改一下
A:cout<<"please input the value of width."<>w;rn if(w<=0)rn cout<<"please input a positive number."<
帮我改一下修改密码的代码,在线等候
[code=C#] private void button1_Click(object sender, EventArgs e)rn rn string User_ID = textBox1.Text;rn string User_PWD = textBox2.Text;rn string a = textBox3.Text;rn int count = 0;rn tryrn rn string ConnectionString = "Data Source=fly;user=fly;password=fly";//写连接串 rn OracleConnection conn = new OracleConnection(ConnectionString);//创建一个新连接 rnrn conn.Open();rn OracleCommand cmd = conn.CreateCommand();rn cmd.CommandText = "select * from alarm_user where user_ID='" + User_ID + "'";//在这儿写sql语句 rn OracleDataReader odr = cmd.ExecuteReader();//创建一个OracleDateReader对象rn string pwd = "";rn while (odr.Read())//读取数据,如果odr.Read()返回为false的话,就说明到记录集的尾部了 rn rn count++;rn pwd = odr.GetOracleString(1).ToString();rn //MessageBox.Show(odr.GetOracleString(1).ToString());//输出字段1,这个数是字段索引,具体怎么使用字段名还有待研究 rn rn odr.Close();rn cmd.Clone();rn conn.Close();rn rn if (count == 0)rn rn MessageBox.Show("没有此用户");rn textBox2.Text = "";rn textBox1.Text = "";rn this.textBox1.Focus();rnrn rn elsern rn if (User_PWD.Equals(pwd))rn rn string ConnectionString = "Data Source=fly;user=fly;password=fly";//写连接串 rn OracleConnection conn1 = new OracleConnection(ConnectionString);//创建一个新连接 rnrn conn1.Open();rn OracleCommand cmd1 = conn.CreateCommand();rn cmd1.CommandText = "update alarm_user set user_pwd='" + a + "'";//在这儿写sql语句 rn OracleDataReader odr1 = cmd.ExecuteReader();//创建一个OracleDateReader对象rn cmd1.Clone();rn odr1.Close();rn conn1.Close();rn MessageBox.Show("修改成功!!");rn textBox1.Text = "";rn textBox2.Text = "";rn textBox3.Text = "";rn rnrn rn elsern rn MessageBox.Show("密码错误,请重新输入!");rn textBox2.Text = "";rn textBox3.Text = "";rn this.textBox1.Focus();rn rnrn rnrn rn rn rn catch (Exception ee)rn rn MessageBox.Show(ee.Message.ToString());rn rn rn[/code]rnrnrnrn就是一个用户修改密码的代码,输入账号,旧密码和新密码后实现把oracle里的数据库里的密码给改掉,这个代码是有问题的,我不知道应该怎么改了,请大家帮下忙了rn
复制树的代码,请帮我改一下.
昨天在这问的一个clone树的问题,自己写了个递归代码,不行,子节点还是没有。rn初学者,代码写的比较糟糕,还请朋友们多指点。rnvoid copyTree(DefaultMutableTreeNode oldNode,DefaultMutableTreeNode newNode)rnrn if(oldNode!=null)rn rn newNode=new DefaultMutableTreeNode();rn newNode.setAllowsChildren(true);rn for(int i=0;i
谁能帮我改一下代码(一个存储过程)
在已有代码的基础上加一个输入参数 字符型的。rn在select语句中加个判断rnrnCREATE OR REPLACE PACKAGE guanli_d1rnASrnrnTYPE twbid IS TABLE of managerinfo.wbid %TYPE INDEX BY BINARY_INTEGER;rnTYPE twbname IS TABLE of managerinfo.wbname %TYPE INDEX BY BINARY_INTEGER;rnTYPE tcount_1 IS TABLE of int INDEX BY BINARY_INTEGER;rnTYPE tcount_2 IS TABLE of int INDEX BY BINARY_INTEGER;rnrnPROCEDURE get_userinforn(rnthewbid OUT twbid,rnthewbname OUT twbname,rntheCount_1 OUT tcount_1,rntheCount_2 OUT tcount_2rn);rnend guanli_d1;rnrnCREATE OR REPLACE PACKAGE BODY guanli_d1rnASrnPROCEDURE get_userinforn(rntheflag in varchar2,rnthewbid OUT twbid,rnthewbname OUT twbname,rntheCount_1 OUT tcount_1,rntheCount_2 OUT tcount_2rn)rnASrnCURSOR c1 ISrnrnif ... then --在此判断 输入参数是否等于“wx”rnrnSELECT wbid,wbnamernFROM managerinfornORDER by wbid; rnrnelsernrnSELECT wbid,wbname --在此判断 wbname 的前两个字符等于输入的参数rnFROM managerinfornORDER by wbid; rnrnend ifrnrncounter NUMBER DEFAULT 1;rnBEGIN rnFOR c IN c1 LOOPrnthewbid(counter):=c.wbid;rnthewbname(counter):=c.wbname;rnSELECT COUNT(*) rninto thecount_1(counter) rnFROM userinfo rnWHERE wb_id=thewbid(counter) rnand to_date(startdate,'yyyy-mm-dd')=trunc(SYSDATE) rnand biaozhi='T';rncounter :=counter+1;rnEND LOOP; rnrnEND get_userinfo;rnEND guanli_d1;rnrn本初学oracle存储过程,还请大家多帮忙。rn源程序已经测试过,没错。rn我也自己试着改过,编译时没错,可在asp中没法调用。
找人帮我改一下PHP的代码
我自己感觉很简单的,我是一点PHP都没学过,感觉挺简单的。就是把这个网站的下面的安全论坛模块稍微改好看一点,排一下版。哪位懂PHP的哥们帮帮忙。 rn网址是:www.twohk.com QQ:270459714rn
谁帮我改一下access的数据库连接代码
我在web.config文件里面定义的rnrn我在程序里面是这样引用的:rnconn = new OleDbConnection(ConfigurationSettings.AppSettings["cnFriends.ConnectionString"]);rnrn但是出现错误,谁能帮我改一下啊,困扰我一个星期的问题了
谁帮我改一下这段代码?
rn <% rn iii=0rndo while not rs.eof and rowcount>0rniii=iii+1rn%>rn rn <%if iii=1 or ((iii mod 5)=1 and (iii>5)) thenrn response.write " "%>rn <%=rs("tile")%>rn <%end if%>rn rn <%if iii=5 or (iii mod 5)=0 thenrn response.write ""rn end ifrn %>rn rn <%rnrowcount=rowcount-1rnrs.movenext rnlooprnend ifrnend if rnrs.closernconn.closernset rs=nothingrnset coon=nothingrnend ifrn%>rnrn rn
帮我改代码!
dim Ausername,Axingmcolor,Abiaoqing,Atowho,Acontent,AsaycolorrnAusername=session("username")rn Axingmcolor=request("xmcolor")rn Abiaoqing=request("bqing")rn Atowho=request("twho")rn Acontent=Server.HTMLEncode(request("text"))rn Acontent=replace(Acontent,"'","''")rn Asaycolor=request("scolor")rnSet conn = Server.CreateObject("ADODB.Connection")rnDBPath = Server.MapPath("../db/ktjlu.mdb")rnconn.Open "driver=Microsoft Access Driver (*.mdb);dbq=" & DBPathrnSet rs = Server.CreateObject("ADODB.Recordset")rnrs.Open "Select * from newchat Order By chattime desc",conn,3,3rnrnrs.AddNewrnrs.fields("username")=Ausernamernrs.fields("xingmcolor")=Axingmcolorrnrs.fields("biaoqing")=Abiaoqingrnrs.fields("towho")=Atowhornrs.fields("content")=Acontentrnrs.fields("saycolor")=Asaycolorrnrs.fields("chattime")=now()rnrs.Updaternrnrs.Closernset rs=Nothingrnconn.Closernset conn=Nothingrn怎么在update处出错,chattime是主键rn
请大神帮我看看代码为何报错
报错提示:left是不明确的符号,为什么?rnrn[code=c]#include rn#include rnusing namespace std;rn#define maxn 100rnint left,chance;rnchar s1[maxn],s2[maxn];rnint win,lose;rnrnvoid guess(char ch)rnrnint flag=1;rnfor(int i=0;i
初学者一枚 希望有大神指教一下程序调用的问题
我这有一个加密的程序 也有说明 但是看不懂 不知道怎么样才能调用其中加密程序运行 希望大神指点
求助大神,本人菜鸟一枚,帮忙看看代码都是什么意思
菜鸟一枚,从未接触过VB代码思路是VB作为客户端,读取WiFi服务器的数据,读取的数据格式是fre:**MVPP:****mv;并在坐标轴上绘制成幅频曲线,求求大神帮帮忙啊[code=vb][/code]Dim receive_data(257) As StringrnDim myArray(2) As StringrnDim X(20) As StringrnDim MyCaption(20) As StringrnDim X1 As Single, Y1 As SinglernDim X2 As Single, Y2 As SinglernrnrnPublic Sub RefreshGraph()rn Dim MyColor(2) As Longrn Dim MyLegend(0) As Stringrn Dim i As Integerrn For i = 1 To 20rn MyCaption(i) = irn rn Next irn rn MyColor(0) = vbRedrn rn Chart1.MinValue = 0rn Chart1.Rows = 20rn Chart1.Cols = 20rn Chart1.DrawGraph myArray, MyColor, MyCaptionrn rn MyLegend(0) = "幅频采集图"rn rn Chart1.DrawLegend MyLegend, MyColorrnEnd SubrnrnPrivate Function InsertDB(ByVal table_name As String, ByVal value As String) As Bytern On Error GoTo gperrorrn rn Dim objCn As New ADODB.Connectionrn Dim objRs As New ADODB.Recordsetrn Dim strCn As Stringrn Dim strSQL As Stringrn ' 定义数据库连接参数变量 myArray(0) = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"rn Dim i As Integerrn For i = 1 To 20rn X(20) = "0"rn rn Next irn Chart1.MaxValue = 2000rn rn RefreshGraphrn Dim db_host As Stringrn Dim db_user As Stringrn Dim db_pass As Stringrn Dim db_data As Stringrn ' 初始化数据库连接变量rn db_host = "127.0.0.1"rn db_user = "root"rn db_pass = "root"rn db_data = "fupin"rn objCn.ConnectionString = "DRIVER=MySQL ODBC 5.1 Driver;" & _rn "SERVER=" & db_host & ";" & _rn "DATABASE=" & db_data & ";" & _rn "UID=" & db_user & ";PWD=" & db_pass & ";" & _rn "OPTION=3;stmt=SET NAMES GB2312"rnrn objCn.Openrnrn rn strSQL = "INSERT INTO " + fupinshuju + "(Fre,VPP) VALUES(" + Chr(34) + Fre + Chr(34) + "," + Chr(34) + VPP + Chr(34) + ");"rn Set objRs.ActiveConnection = objCnrn objRs.Open (strSQL)rn rn rn '关闭数据库连接,释放对象rn objCn.Closern Set objRs = Nothingrn Set objCn = Nothingrn Exit Functionrn rngperror:rn Check_PassWord = 255rn Set objRs = Nothingrn Set objCn = NothingrnEnd FunctionrnrnPrivate Sub CmdSend_Click()rn If (tcpserver.State = 7) Thenrn tcpserver.SendData txtSend.Textrn txtSend.Text = ""rn End Ifrn rnEnd SubrnrnPrivate Sub CmdStart_Click()rnrnrn If (tcpserver.State <> 7) Thenrn tcpserver.Closern tcpserver.Connect txtIP.Text, txtPort.Textrn 'tcpserver.Connect "127.0.0.1", txtPortrn Elsern tcpserver.Closern CmdStart.Caption = "连接服务"rn txtIP.Enabled = Truern txtPort.Enabled = Truern txtIP.BackColor = &H80000005rn txtPort.BackColor = &H80000005rn End IfrnrnEnd SubrnrnrnrnPrivate Sub Form_Load()rn Me.Left = Screen.Width / 2 - Me.Width / 2rn Me.Top = Screen.Height / 2 - Me.Height / 2 '全屏下让窗体居中rn rn rn rn 'txtIP.Text = tcpserver.LocalIPrn txtIP.Text = "192.168.4.1"rn txtPort.Text = 8086rn rn If (tcpserver.State <> 7) Thenrn CmdStart.Caption = "连接服务"rn txtIP.Enabled = Truern txtPort.Enabled = Truern txtIP.BackColor = &H80000005rn txtPort.BackColor = &H80000005rn Elsern CmdStart.Caption = "断开服务"rn End Ifrn rn MyCaption(0) = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"rn Dim i As Integerrn For i = 1 To 20rn X(i) = "0"rn rn Next irn Chart1.MaxValue = 2000rn rn RefreshGraph '刷新rn rn 'txtMQ2.Text = pm25(1) + "," + pm25(2) + "," + pm25(3) + "," + pm25(4) + "," + pm25(5) + "," + pm25(6) + "," + pm25(7) + "," + pm25(8) + "," + pm25(9) + "," + pm25(10)rn rnEnd SubrnrnPrivate Sub Form_Unload(Cancel As Integer)rn tcpserver.ClosernEnd SubrnrnrnrnPrivate Sub tcpserver_Close()rn tcpserver.Closern CmdStart.Caption = "连接服务"rn txtIP.Enabled = Truern txtPort.Enabled = Truern txtIP.BackColor = &H80000005rn txtPort.BackColor = &H80000005rnEnd SubrnrnPrivate Sub tcpserver_Connect()rn CmdStart.Caption = "断开服务"rn txtIP.Enabled = Falsern txtPort.Enabled = Falsern txtIP.BackColor = &H80000000rn txtPort.BackColor = &H80000000rnEnd SubrnrnPrivate Sub tcpserver_ConnectionRequest(ByVal requestID As Long)rnrn If tcpserver.State <> sckClosed Thenrn tcpserver.Closern End Ifrn tcpserver.Accept requestIDrnrnEnd SubrnrnPrivate Sub tcpserver_DataArrival(ByVal bytesTotal As Long)rn rn Dim value As Stringrn Static k As Integerrn Dim j As Integerrn Dim f As Stringrn Dim v As Stringrn k = tcpserver.BytesReceivedrn tcpserver.GetData receive_data(0), vbByte, k '从k读取的存放在receive_data中,读取数据的类型是字节rn value = receive_data(0)rn rn rn If (StrComp(Mid(value, 1, 3), "Fre") = 0 And StrComp(Left(Right(value, 10), 3), "VPP") = 0) Then 'strcomp字符串比较函数rn rn f = Mid(value, 1, Len(value) - 10) 'fre的值fre:___20Mrn End Ifrn rn rn rnrn txtRecv.Text = txtRecv.Text + Mid(value, 1, InStr(7, value, "M")) 'instr 返回要截取的字符串rnrn f = Mid(value, 5, InStr(5, value, "M") - 5) '频率单独数值rn v = Mid(value, 12, 4)rn rn rn rn strSQL = "INSERT INTO " + fupinshuju + "(Fre,VPP) VALUES (" + Chr(34) + Trim(f) + Chr(34) + "," + Chr(34) + Trim(v) + Chr(34) + ");" '插入幅频数据至MySQLrn 'Set objRs.ActiveConnection = objCnrn 'objRs.Open (strSQL)rn rn X(20) = Trim(f)rn MyCaption(20) = Trim(v)rn Chart1.CurrentX = Trim(f)rn Chart1.CurrentX = Trim(v)rn Chart1.Print "Trim(f),Trim(v)"rn Circle (Trim(f), Trim(v)), 5 rnEnd Subrn帮帮忙啊,最后不知道怎么在坐标轴上描点画曲线,求求大神帮帮忙
求大神帮助,菜鸟一枚。
[code=c][/code]5 如何解决rn[Linker Fatal Error] Fatal: Could not open C:\Program Files (x86)\Borland\CBuilder6\Projects\Project1.exe (error code 5)
帮忙改一下代码!
下面这段代码本来我以为写对了,也交差了,后来才发现s与v的值都少除255。这下我该怎么办呢,地址都是字节地址却要传一个双精度数?rnrn......rntype//相关类型定义rn TRGB=recordrn R,G,B:BYTE;rn end;rn TRGBLine=array[0..65535]of TRGB;rn PRGBLine=^TRGBLine;rn arr=array[0..255]of byte;rn THue=0..359;rn THSV=recordrn H:THue;rn S,V:byte;rn end;rn......rnprocedure TForm1.Button1Click(Sender: TObject);rnvar i,j:integer;rn scanline:PRGBLine;rn H:Thue;rn S,V:byte;rn bmp:Tbitmap;rnbeginrn bmp:=TBitmap.Create;rn bmp.Assign(image1.picture.Bitmap);rn for i:=0 to image1.Height-1 dorn beginrn scanline:=Bmp.Scanline[i];rn for j:=0 to bmp.Width-1 dorn beginrn rgb2hsv(scanline[j].R,scanline[j].G,scanline[j].B,H,S,V);rn scanline[j].R:=H;rn scanline[j].G:=S;//现在要把s和v的值都除255,除了之后就变成double了,因为s和v的值本来是0到255之间的数rn scanline[j].B:=V;rn end;rn end;rn Image2.Picture.Bitmap.Assign(bmp);rn Image2.Refresh;rn bmp.Free;rnend;rn
帮帮忙,改一下代码!
procedure Tform1.hsv2rgb(Hue:Thue;saturation,value:byte;var red,green,blue:byte);rnvarrn f,h,m,n:Double;rn a:integer;rn w,y,z:byte;rnbeginrn m:=saturation/255;rn if m=0 then //这里出错显示“left side cannot be assigned to”rn red:=green:=blue:=valuern elsern beginrn h:=hue/60;rn a:=hue div 60;rn f:=h-a; //这里显示“incompatible type:‘byte’and‘extended’rn w:=value*(1-m);//同上一句同样的错误rn y:=value*(1-m*f);//同上一句同样的错误rn rn z:=value*(1-m*(1-f));//同上一句同样的错误rn rn case a ofrn 0: red:=value,green:=k,blue:=m;rn 1: red:=y,green:=value,blue:=m;rn 2: red:=w,green:=value,blue:=k;rn 3: red:=w,green:=n,blue:=value;rn 4: red:=z,green:=m,blue:=value;rn 5: red:=value,green:=m,blue:=n;rn end;rnend;
帮忙改一下代码
namespace Biz.Client.RP.RP01rnrn public partial class subForm_RP0111 : ControlBasern rn //调用服务器端方法的路径rn string serverCall_Str = "Biz.Server.RP.RP01.DLL#Biz.Server.RP.RP01.BF_RP0111#";rn rn //从数据库中获取RP_UPLOADFLAG的记录rn DataSet ds_BD_SYS = new DataSet();rn DataTable dt_BD_SYS = new DataTable();rnrn public subForm_RP0111()rn rn InitializeComponent();rn rnrn public void LoadAll()rn rn string sSqL = "select t.ssysparm_code, t.ssysparm_vale, t.scorpcode from bd_sys t where t.ssysparm_code='RP_UPLOADFLAG' and t.scorpcode='" + UIP.FrameManager.GetGlobalVariable().CorpCode + "'";rn string[] arr = new string[1];rn arr[0] = sSqL;rn object[] args = new object[1];rn args[0] = arr;rnrn ReturnObject retObj_GetRP_UpLoadFlag = this.UIP.FrameManager.ServerCall(serverCall_Str + "getDataSet",args);rnrn ds_BD_SYS = retObj_GetRP_UpLoadFlag.ReturnValue as DataSet;rn dt_BD_SYS = ds_BD_SYS.Tables["bd_sys"];rnrn //如果不存在RP_UPLOADFLAG的记录rn if (dt_BD_SYS.Rows.Count == 0)rn rn //关闭预算开关rn setRPOpen(false);rn //关闭监管开关rn setJGOpen(false);rn //关闭决算开关rn setBGOpen(false);rn rn //如果存在RP_UPLOADFLAG的记录rn elsern rn //判断RP_UPLOADFLAG的记录是否为Y/Nrn if (dt_BD_SYS.Rows[0]["ssysparm_vale"].ToString() == "Y"rn || dt_BD_SYS.Rows[0]["ssysparm_vale"].ToString() == "N")rn rn //如果RP_UPLOADFLAG的记录为Yrn if (dt_BD_SYS.Rows[0]["ssysparm_vale"].ToString() == "Y")rn rn //打开预算开关rn setRPOpen(true);rn //关闭监管开关rn setJGOpen(false);rn //关闭决算开关rn setBGOpen(false);rn rn rn //如果RP_UPLOADFLAG的记录为Nrn elsern rn //关闭预算开关rn setRPOpen(true);rn //关闭监管开关rn setJGOpen(false);rn //关闭决算开关rn setBGOpen(false);rn rn rn //如果为标准格式数据(BG:Y/N;JG:Y/N;RP:Y/N)rn elsern rn if (dt_BD_SYS.Rows.Count > 0)rn rn string flag = this.dt_BD_SYS.Rows[0]["ssysparm_vale"].ToString();rn switch (flag)rn rn case "RP:N;JG:N;BG:Y":rn setRPOpen(false);rn setJGOpen(false);rn setBGOpen(true);rn break;rn case "RP:N;JG:N;BG:N":rn setRPOpen(false);rn setJGOpen(false);rn setBGOpen(false);rn break;rn case "RP:N;JG:Y;BG:N":rn setRPOpen(false);rn setJGOpen(true);rn setBGOpen(false);rn break;rn case "RP:N;JG:Y;BG:Y": rn setRPOpen(false);rn setJGOpen(true);rn setBGOpen(true);rn break;rn case "RP:Y;JG:N;BG:N":rn setRPOpen(true);rn setJGOpen(false);rn setBGOpen(false); rn break;rn case "RP:Y;JG:N;BG:Y":rn setRPOpen(true);rn setJGOpen(false);rn setBGOpen(true);rn break;rn case "RP:Y;JG:Y;BG:N": rn setRPOpen(true);rn setJGOpen(true);rn setBGOpen(false);rn break;rn case "RP:Y;JG:Y;BG:Y":rn setRPOpen(true); rn setJGOpen(true);rn setBGOpen(true);rn break;rn rn rn elsern rn //关闭预算开关rn setRPOpen(false);rn //关闭监管开关rn setJGOpen(false);rn //关闭决算开关rn setBGOpen(false);rn rn rn rn rnrn /// rn /// 设置预算开关状态rn /// rn /// rn private void setRPOpen(bool beOpen)rn rn if (beOpen == true)rn rn this.yytRadioButton_RP_Open.Checked = true; rn rn elsern rn this.yytRadioButton_RP_Close.Checked = true;rn rn rn /// rn /// 获取预算开关状态rn /// rn /// rn private bool getRPOpen()rn rn if (this.yytRadioButton_RP_Open.Checked == true)rn rn return true;rn rn else if (this.yytRadioButton_RP_Close.Checked == true)rn rn return false;rn rn return false;rn rnrn /// rn /// 设置监管开关状态rn /// rn /// rn private void setJGOpen(bool beOpen)rn rn if (beOpen == true)rn rn this.yytRadioButton_JG_Open.Checked = true; rn rn elsern rn this.yytRadioButton_JG_Close.Checked = true;rn rn rn /// rn /// 获取监管开关状态rn /// rn /// rn private bool getJGOpen()rn rn if (this.yytRadioButton_JG_Open.Checked == true) rn rn return true;rn rn else if (this.yytRadioButton_JG_Close.Checked == true)rn rn return false;rn rn return false;rn rnrn /// rn /// 设置决算开关状态rn /// rn /// rn private void setBGOpen(bool beOpen)rn rn if (beOpen == true)rn rn this.yytRadioButton_BG_Open.Checked = true; rn rn elsern rn this.yytRadioButton_BG_Close.Checked = true;rn rn rn /// rn /// 获取决算开关状态rn /// rn /// rn private bool getBGOpen()rn rn if (this.yytRadioButton_BG_Open.Checked == true) rn rn return true;rn rn else if (this.yytRadioButton_BG_Close.Checked == true)rn rn return false;rn rn return false;rn rnrn private string getAllOpenStatus()rn rn //三个开关的状态rn string allOpenStatus ="";rn //预算开关状态rn string RPOpenStatus="";rn //决算开关状态rn string BGOpenStatus="";rn //监管开关状态rn string JGOpenStatus="";rnrn if (getBGOpen() == true)rn rn BGOpenStatus = "BG:Y";rn rn if (getBGOpen() == false)rn rn BGOpenStatus = "BG:N";rn rn if (getJGOpen() == true)rn rn JGOpenStatus = "JG:Y";rn rn if (getJGOpen() == false)rn rn JGOpenStatus = "JG:N";rn rn if (getRPOpen() == true)rn rn RPOpenStatus = "RP:Y";rn rn if (getRPOpen() == false)rn rn RPOpenStatus = "RP:N";rn rn rn allOpenStatus=RPOpenStatus + ";" + JGOpenStatus + ";" + BGOpenStatus;rn return allOpenStatus; rn rnrn private void btn_Save_Click(object sender, EventArgs e)rn rn Datasave();rn rn //退出rn private void btn_Exit_Click(object sender, EventArgs e)rn rn dt_BD_SYS.Rows[0]["ssysparm_vale"] = getAllOpenStatus();rn rn if (dt_BD_SYS.GetChanges() == null)rn rn this.UIP.FrameManager.CloseSubForm();rn rn elsern rn DialogResult dr = this.UIP.FrameManager.ShowQuestion("!提示","数据已改变,是否要保存?", MessageBoxButtons.YesNo);rn if (dr == DialogResult.Yes)rn rn Datasave();rn rn elsern rn this.UIP.FrameManager.CloseSubForm();rn rn rn rn rn点击退出时,无论数据是否改变都出提示框为什么?
帮忙改一下代码?
这是一个点击按钮让图层从左向右移动的代码,我想另外加上一个按钮,点击时让图层rn停下来再从右向左移动,各位帮忙!谢谢rnrnrn rn
哪位大神能帮我写一下代码
写一个猜数游戏的JSP代码?其程序运行图与其类似:rn [img=http://img.my.csdn.net/uploads/201211/08/1352376653_3339.png][/img]rn需要有时间限制。rn提示:rn(1)定时函数:setTimeout(“时间到使用函数”,毫秒数)rn(2)按钮的使能属性:disable属性值为true该按钮不可能使用;当其值为false时,该按钮可以接受使用。
求大神帮我代码大概注释一下
public class MainActivity extends Activity n private int i = 0;n private Handler handler;n private ImageView mouse;n private TextView textView ;n private ImageView integral; //整体图片n private Chronometer ch ; //计时器n private SoundPool pool; //播放音效n private static MediaPlayer mp = null; n private HashMap soundmap = new HashMap();n public int[][] position = new int[][] 150, 100 , 250, 100 , //地鼠出现的位置n 350, 100 , 450, 100 , 550, 100 , 650, 100 ,n 50, 100 , 150, 220 , 250, 220 , 350, 510 ,n 450, 220 , 550, 220 , 650, 220 , 50, 220 ;nn @Overriden protected void onCreate(Bundle savedInstanceState) n super.onCreate(savedInstanceState);n setContentView(R.layout.activity_main);n n //音乐n //如果音乐不为空,释放n if(mp != null)n mp.release();n n mp = MediaPlayer.create(MainActivity.this, R.raw.dalaoshu);n mp.start();n n //计时器n ch = (Chronometer) findViewById(R.id.chronometer1);n ch.setBase(SystemClock.elapsedRealtime());//复位计时器,停止计时n ch.setFormat("已用时间:%s");n ch.start();n //设置监听n ch.setOnChronometerTickListener(new OnChronometerTickListener() n n @Overriden public void onChronometerTick(Chronometer chronometer) n //如果从开始到现在超过了30sn if(SystemClock.elapsedRealtime() - ch.getBase() >= 30000)n Intent intent = new Intent(MainActivity.this,Finish.class);n Bundle bundle = new Bundle();n bundle.putInt("num", i);n intent.putExtras(bundle);n startActivity(intent);n finish();n n n );n n textView = (TextView) findViewById(R.id.textView1);n mouse = (ImageView) findViewById(R.id.imageView1);n integral=(ImageView) findViewById(R.id.imageView2);n integral.setVisibility(View.INVISIBLE);n pool = new SoundPool(2, AudioManager.STREAM_SYSTEM, 0);n soundmap.put(1, pool.load(MainActivity.this, R.raw.dalaoshu,1));n soundmap.put(2, pool.load(MainActivity.this, R.raw.enter,1));n pool.play(soundmap.get(1), 1, 1, 0, -1, 1);n final Animation translate = AnimationUtils.loadAnimation(MainActivity.this, R.anim.anim_translate);n mouse.setOnTouchListener(new OnTouchListener() nn @Overriden public boolean onTouch(View v, MotionEvent event) n v.setVisibility(View.INVISIBLE);// 设置地老鼠不显示n i++;n pool.play(soundmap.get(2), 1, 1, 0, 0, 1);n integral.startAnimation(translate);n integral.setVisibility(View.INVISIBLE);n textView.setText("积分:"+i+"0");n return false;n n );n handler = new Handler()n n @Overriden public void handleMessage(Message msg) n int index = 0;n if(msg.what == 0x111)n index = msg.arg1;n mouse.setX(position[index][0]);n mouse.setY(position[index][1]);n mouse.setVisibility(View.VISIBLE);n n n super.handleMessage(msg);n n ;n Thread t = new Thread(new Runnable() n n @Overriden public void run() n int index = 0;n while(!Thread.currentThread().isInterrupted())n index = new Random().nextInt(position.length);n Message m = handler.obtainMessage();n m.what = 0x111;n m.arg1 = index;n handler.sendMessage(m); n try n Thread.sleep(new Random().nextInt(240)+200);n n catch (InterruptedException e) n e.printStackTrace();n n n n n );n t.start();n n @Overriden protected void onDestroy() n if(mp != null)n mp.stop();n mp.release();n mp=null;n n super.onDestroy();n n
哪位大神帮我翻译一下代码
我的程序是c++写的,运行到某处报错,不知道在哪,只能看汇编rn rncall dword ptr [edx+0x14]rn 那个帮我把这句翻译成c的代码