INT的问题 [英] Problem with INT

查看:63
本文介绍了INT的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喂,&NBSP;我&NBSP;试图做&NBSP;一个按钮&NBSP;即<克类= QUOT; gr_ gr_101 GR-警报gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 101" ID = QUOT; 101">每次< / g取代;
你点击他是数字值的两倍(金钱价值)。


但是,有一个问题,我随机使用随机事件将值重置为1。


我遇到了代码问题,他有时候工作得很好,有时也不会对数学有好处。 (I创建保存&NBSP;<克类= QUOT; gr_ gr_73 GR-警报gr_spell gr_inline_cards gr_run_anim ContextualSpelling INS-德尔
multiReplace"数据-GR-ID =" 73" ID = QUOT; 73"> moneybalance< / G>&NBSP;即定位和计算你的钱余额和&NBSP;每次&NBSP;你推的是&NBSP按钮;添加&NBSP;< G类别=" gr_ gr_89 GR-警报gr_gramm gr_inline_cards
gr_run_anim语法multiReplace"数据-GR -id =" 89" ID =" 89">你的钱< / G>&NBSP;你&NBSP;实现&NBSP;从按下按钮到&NBSP;正确&NBSP;平衡,但它有时做了错误的数学和&NBSP;有时&NBSP;其
重置值或做&NBSP;东西&NBSP;即<克类= QUOT; gr_ gr_148 GR-警报gr_gramm gr_inline_cards gr_run_anim语法multiReplace"数据-GR-ID =" 148" ID = QUOT; 148"> make< / g> the balance less。


我 < g class =" gr_ gr_194 gr-alert gr_gramm gr_inline_car ds gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep"数据-GR-ID =" 194" id =" 194"> beginner< / g> 所以 我认为
代码 它不是那么复杂但是我希望你能帮助我找到我的错误。


谢谢< 3





谢谢< 3




使用System; 
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;使用System.Windows
;使用System.Windows.Controls
;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;使用System.Windows.Navigation
;
使用System.Windows.Shapes;

名称空间WpfApp1
{
///< summary>
/// MainWindow.xaml的交互逻辑
///< / summary>
public partial class MainWindow:Window
{
int t1; //按钮中的值

int balance; //来自按钮的余额

int a; // random_num

int savedbalance; //当前余额,(他通过点击按钮得到
+ _balance)

public MainWindow()
{
InitializeComponent();
t1 = 1;
Money.FontSize = 72; // money = labelname
Money.FontWeight = FontWeights.Bold;

}



private void CB_Click_1(对象发送者,RoutedEventArgs e)
{
随机r =新随机( );
int a = r.Next(1,100);
te.Content = a;

if(a< 90)
{
if(t1< 1000)
{
Money.Content = t1;
t1 = t1 + t1;
}
其他
{
Money.FontSize = 50;
Money.Content = t1;
t1 = t1 + t1;
}
}其他
{
t1 = 1;
Money.Content = t1;

}


}

private void Button_Click(对象发送者,RoutedEventArgs e)
{

余额= t1 / 2;
MonBalance.FontSize = 35; //已保存余额
标签名称
MonBalance.Content = savedbalance +
余额;
Money.FontWeight = FontWeights.Bold;
savedbalance = balance;
t1 = 1;





}
}
}





解决方案

<克类= QUOT; gr_ gr_13 GR-警报gr_spell gr_inline_cards gr_run_anim ContextualSpelling INS-德尔multiReplace" ;数据-GR-ID =" 13 QUOT; ID = QUOT 13 QUOT;> IM< / g取代;尝试做< g class =" gr_ gr_197 gr-alert gr_gramm gr_inline_cards
gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep"数据-GR-ID =" 197" ID = QUOT; 197">按钮< / g取代;每当你点击他时,它的数值(金钱价值)加倍。


但是,有一个问题,我随机使用一个将值重置为1的事件。


我遇到了代码问题,他有时工作得很好,有时< g class =" gr_ gr_411 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 411" ID = QUOT; 411">不要< / g取代;
到数学< g class =" gr_ gr_438 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace"数据-GR-ID =" 438" ID = QUOT; 438">良好的< / g取代。 (I创建保存<克类= QUOT; gr_ gr_484 GR-警报gr_spell gr_inline_cards
gr_run_anim ContextualSpelling INS-德尔multiReplace"数据-GR-ID =" 484" ID = QUOT; 484"> moneybalance< / g取代;使得位于和计数您的货币余额和<克类= QUOT; gr_ gr_689 GR-警报gr_spell gr_inline_cards gr_run_anim ContextualSpelling
multiReplace"数据-GR-ID =" 689" ID = QUOT; 689">每次< / g取代;你按下按钮<克类= QUOT; gr_ gr_687 GR-警报gr_gramm gr_inline_cards gr_run_anim语法multiReplace"数据-GR-ID =" 687" ID = QUOT; 687">添加< / g取代;
< G类别=" gr_ gr_734 GR-警报gr_gramm gr_inline_cards gr_run_anim语法multiReplace"数据-GR-ID =" 734" ID =" 734">你的钱< / g每个你<克类= QUOT; gr_ gr_722 GR-警报gr_spell gr_inline_cards gr_run_anim
ContextualSpelling INS-德尔multiReplace"数据-GR-ID =" 722" ID = QUOT; 722"&克t; acihve< / g> 从按下按钮到< g class =" gr_ gr_781 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"
data-gr-id =" 781" ID = QUOT; 781">当期的< / g取代;平衡,但它有时会做错误的数学和< g class =" gr_ gr_952 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 952"
id =" 952"> somethimes< / g>它重置该值或执行< g class =" gr_ gr_1057 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 1057" ID = QUOT; 1057">成才< / g取代;
使得余额减少。


< g class =" gr_ gr_1173 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 1173" ID = QUOT; 1173"> IM< / g取代;&NBSP;<克类= QUOT; gr_ gr_1177 GR-警报gr_spell gr_inline_cards
gr_run_anim ContextualSpelling INS-德尔multiReplace"数据-GR-ID =" 1177" id =" 1177"> begginer< / g> < g class =" gr_ gr_1184 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del"数据-GR-ID =" 1184"
id =" 1184"> so< g class =" gr_ gr_1218 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 1218" ID = QUOT; 1218" I标记< / g取代;< / g取代;认为代码< g class =" gr_
gr_1217 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 1217" ID = QUOT; 1217">它的< / g取代;不是那么复杂但是< g class =" gr_ gr_1312 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim
ContextualSpelling multiReplace"数据-GR-ID =" 1312" ID = QUOT; 1312" I标记< / g取代;希望你能帮我找到我的错误。


谢谢你< 3

使用System; 
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;使用System.Windows
;使用System.Windows.Controls
;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;使用System.Windows.Navigation
;
使用System.Windows.Shapes;

名称空间WpfApp1
{
///< summary>
/// MainWindow.xaml的交互逻辑
///< / summary>
public partial class MainWindow:Window
{
int t1; //按钮中的值

int balance; //来自按钮的余额

int a; // random_num

int savedbalance; //当前余额,(他通过点击按钮得到
+ _balance)

public MainWindow()
{
InitializeComponent();
t1 = 1;
Money.FontSize = 72; // money = labelname
Money.FontWeight = FontWeights.Bold;

}



private void CB_Click_1(对象发送者,RoutedEventArgs e)
{
随机r =新随机( );
int a = r.Next(1,100);
te.Content = a;

if(a< 90)
{
if(t1< 1000)
{
Money.Content = t1;
t1 = t1 + t1;
}
其他
{
Money.FontSize = 50;
Money.Content = t1;
t1 = t1 + t1;
}
}其他
{
t1 = 1;
Money.Content = t1;

}


}

private void Button_Click(对象发送者,RoutedEventArgs e)
{

余额= t1 / 2;
MonBalance.FontSize = 35; //已保存余额
标签名称
MonBalance.Content = savedbalance +
余额;
Money.FontWeight = FontWeights.Bold;
savedbalance = balance;
t1 = 1;





}
}
}




Hey, I'm trying to do a button that <g class="gr_ gr_101 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="101" id="101">everytime</g> you click on him its double the number value (money value).

But, there is a catch, I use random to random an event that Reset the Value to 1.

I got a problem with the code, he is working well sometimes and sometimes doesn't to the math good. (I create saved <g class="gr_ gr_73 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="73" id="73">moneybalance</g> that located and count your money balance and every time you push the button that adds <g class="gr_ gr_89 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="89" id="89">your money</g> that you achieve from pressing the button to the correct balance but its sometimes do a wrong math and sometimes its reset the value or do a something that <g class="gr_ gr_148 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="148" id="148">make</g> the Balance less.

I'm <g class="gr_ gr_194 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="194" id="194">beginner</g> so I think the code it's not so complicated but I hope you can help me to find my bug.

Thank you <3

Thank you <3


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        int t1; //value in the button

        int balance; //balance from the button

        int a; //random_num

        int savedbalance; //currect balance, (He gets 
         +_balance with click on button)

        public MainWindow()
        {
            InitializeComponent();
            t1 = 1;
            Money.FontSize = 72; //money= labelname
            Money.FontWeight = FontWeights.Bold;

        }



        private void CB_Click_1(object sender, RoutedEventArgs e)
        {
            Random r = new Random();
            int a = r.Next(1, 100);
            te.Content = a;

            if (a<90)
            {
                if (t1 < 1000)
                {
                    Money.Content = t1;
                    t1 = t1 + t1;
                }
                else
                {
                    Money.FontSize = 50;
                    Money.Content = t1;
                    t1 = t1 + t1;
                }
            } else
            {
                t1 = 1;
                Money.Content = t1;

            }


        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
       
                balance = t1 / 2;
                MonBalance.FontSize = 35; //saved balance 
                label name
                MonBalance.Content = savedbalance + 
                balance;
                Money.FontWeight = FontWeights.Bold;
                savedbalance = balance;
                t1 = 1;
            




        }
    }
}



解决方案

Hey, <g class="gr_ gr_13 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="13" id="13">im</g> trying to do <g class="gr_ gr_197 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="197" id="197">button</g> that everytime you click on him its double the number value (money value).

But, there is a catch, I use random to random an event that Reset the Value to 1.

I got a problem with the code, he is working well sometimes and sometimes <g class="gr_ gr_411 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="411" id="411">dont</g> to the math <g class="gr_ gr_438 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="438" id="438">good</g>. (I create saved <g class="gr_ gr_484 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="484" id="484">moneybalance</g> that located and count your money balance and <g class="gr_ gr_689 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="689" id="689">everytime</g> you push the button that <g class="gr_ gr_687 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="687" id="687">add</g> <g class="gr_ gr_734 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="734" id="734">your money</g> that you <g class="gr_ gr_722 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="722" id="722">acihve</g> from pressing the button to the <g class="gr_ gr_781 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="781" id="781">currect</g> balance but its sometimes do a wrong math and <g class="gr_ gr_952 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="952" id="952">somethimes</g> its reset the value or do a <g class="gr_ gr_1057 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="1057" id="1057">someting</g> that make the Balance less.

<g class="gr_ gr_1173 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="1173" id="1173">Im</g> <g class="gr_ gr_1177 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="1177" id="1177">begginer</g> <g class="gr_ gr_1184 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" data-gr-id="1184" id="1184">so <g class="gr_ gr_1218 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="1218" id="1218">i</g></g> think the code <g class="gr_ gr_1217 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="1217" id="1217">its</g> not so complicated but <g class="gr_ gr_1312 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="1312" id="1312">i</g> hope you can help me to find my bug.

Thank you <3

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        int t1; //value in the button

        int balance; //balance from the button

        int a; //random_num

        int savedbalance; //currect balance, (He gets 
         +_balance with click on button)

        public MainWindow()
        {
            InitializeComponent();
            t1 = 1;
            Money.FontSize = 72; //money= labelname
            Money.FontWeight = FontWeights.Bold;

        }



        private void CB_Click_1(object sender, RoutedEventArgs e)
        {
            Random r = new Random();
            int a = r.Next(1, 100);
            te.Content = a;

            if (a<90)
            {
                if (t1 < 1000)
                {
                    Money.Content = t1;
                    t1 = t1 + t1;
                }
                else
                {
                    Money.FontSize = 50;
                    Money.Content = t1;
                    t1 = t1 + t1;
                }
            } else
            {
                t1 = 1;
                Money.Content = t1;

            }


        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
       
                balance = t1 / 2;
                MonBalance.FontSize = 35; //saved balance 
                label name
                MonBalance.Content = savedbalance + 
                balance;
                Money.FontWeight = FontWeights.Bold;
                savedbalance = balance;
                t1 = 1;
            




        }
    }
}



这篇关于INT的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆