大佬教程收集整理的这篇文章主要介绍了为什么我的变量变成了不同的东西,比如我将 3 赋值给它,它变成了 51?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
using System;
using System.Collections.Generic;
using System.linq;
using System.Text;
using System.Threading.Tasks;
namespace Sololearn
{
class Program
{
static voID Main(String[] args)
{
int value = 371;
int cL;
List<int> numberList = new List<int>();
String Sayı = value.ToString(); //to make value to String so I Could
int L = Sayı.Length; // count length and putto array
char[] chararray = Sayı.tochararray();
foreach(char chr in chararray) // getTing digits multiply with himself for L times
{
cL = chr; // chr İS 3 BUT WHEN ASSİGNED TO cL İT CHANGES TO 51
Console.Writeline(chr) // gives 3
Console.Writeline(cL) // gives 51
double nmbr = Math.Pow(cL,L); // calculaTing power etc
int charr = (int) nmbr; // assign result to int
numberList.Add(charr); // take assigned int to List
}
int @R_131_10586@l = numberList.sum();
if (@R_131_10586@l == value)
{
Console.Writeline("true");
}
else
{
Console.Writeline("false");
}
}
}
}
以上是大佬教程为你收集整理的为什么我的变量变成了不同的东西,比如我将 3 赋值给它,它变成了 51?全部内容,希望文章能够帮你解决为什么我的变量变成了不同的东西,比如我将 3 赋值给它,它变成了 51?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。