一些程序,虎哥帮忙

@Ta 2011-03-01 1876点击
if(ispostback)
{string Sfirst=request.form["txtfirst"];
string Ssecond=request.form["txtsecond"]
string Soperation=request.form["optoperaton"];
int nf=0;
int ns=0;
这里冒出的nf.ns是何居心啊!int.tryparse(Sfirst,out nf);
int.tryparse(Sseconed,out ns);这两句是什么意思啊
int nr=0;把0给了nr吗?
if(soperation=="add") 
nr=nf+ns;
else
nr=nf-ns;}
虎哥!+_+
回复列表(3|隐藏机器人聊天)
  • @Ta / 2011-03-02 / /
    string a="1086346";
    int b=0;
    int.tryparse(a,out b);
    /*把a转换成数字并赋值给b*/
  • @Ta / 2011-03-02 / /
    在PHP里面,上面的语句可以用:
    if($_POST['ispostback'])
    {
    $nf=floor($_POST['txtfirst']);
    $ns=floor($_POST['txtsecond']);
    if($_POST['optoperotion'])=='add')
     $nr=nf+$ns;
    else
     $nr=$nf-$ns;
    }
  • @Ta / 2011-03-03 / /
    深奥
添加新回复
回复需要登录