如何从另一个int中减去int中的值 [英] How do I subtract the value from an int with the value from another int

查看:76
本文介绍了如何从另一个int中减去int中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我正在制作一个数学游戏,其中有两个随机数你需要减去

所以我使用随机int生成器,它定义了2个整数,Mathquestion1和mathquestion2它询问mathquestion1 - mathquestion2是什么(mathquestion1和mathquestion2有1到50之间的随机数)

所以我需要减去这些值来定义答案

任何方式我可以这样做

注意:我是C#初学者



我尝试了什么:



 mathquestion1  -  mathquestion2< pre lang =   c# >  

解决方案

如果你'再问一个基本的问题,你真的需要拿起一本关于C#的初学者书并完成它。您需要将值分配给其他变量,以使任何内容有意义并且可用。

  int  result = int1  -  int2; 


  int  answer = mathquestion1  -  mathquestion2 ; 


Ok, so im making a math game where there is two random numbers that u need to subtract
So im using a random int generator, and it defines 2 ints, Mathquestion1 and mathquestion2 it asks about what mathquestion1 - mathquestion2 is (mathquestion1 and mathquestion2 has a random number between 1 and 50 in it)
So i need to subtract those values to define the answer
Any way i can do this
NOTE: Im a C# Beginner

What I have tried:

mathquestion1 - mathquestion2<pre lang="c#">

解决方案

If you're asking such a basic question you REALLY need to pickup a beginners book on C# and work through it. You need to assign the value to some other variable in order for anything to make sense and be usable.

int result = int1 - int2;


int answer = mathquestion1 - mathquestion2;


这篇关于如何从另一个int中减去int中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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