需要帮助修复此#C [英] Need help fixing this #C

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

问题描述

请有人解决这个问题。谢谢

  public   static   string 解密(字符串文字)
{
int num = 0 ;
string text2;
int num5 = 0 ;
尝试
{
num = 1 ;
int num2 = 2 ;
string text = ;
num2 = 3 ;
long arg_25_0 = 1L;
long num3 = Text.Length;
已检查
{
for long num4 = arg_25_0; num4 < = num3; num4 + = 1L)
{
num2 = < span class =code-digit> 4 ;
// text + = Convert.ToString(Convert.ToChar(Strings.Asc(Strings.Mid(Text) ,(int)num4,1)) - 1));
num2 = 5 ;
}
num2 = 6 ;
text2 = text;
}
int arg_6F_0 = num5 + 1 ;
num5 = 0 ;
num5 = num2;
}
}



已添加代码块 - OriginalGriff [/ edit]



我尝试过的事情:



没什么真的................. .................................................. ...

解决方案

查看代码序列:

  int  num2 =  2 ;  //   set num2  
string text = ;
num2 = 3 ; // set num2
long arg_25_0 = 1L;
long num3 = Text.Length;
已检查
{
for long num4 = arg_25_0; num4 < = num3; num4 + = 1L)
{
num2 = < span class =code-digit> 4 ; // set num2
// text + = Convert.ToString(Convert.ToChar(Strings.Asc(Strings.Mid(Text,(int)num4,1)) - 1));
num2 = 5 ; // set num2
}
num2 = 6 ; // set num2
num5 = 0 < /跨度>;
num5 = num2;



所有那些 num2 的硬编码作业,让人无法理解代码应该是这样做的。它看起来就像是你闭着眼睛写的。


引用:

请有人解决这个问题。谢谢



我们不能 - 我们不知道它有什么问题!

另外,我们不知道它应该做什么,它实际上做了什么,或者我们可以测试它的任何输入数据的想法,更不合适的输出来比较它完成时。



所以,它的去取决于你。

在函数的第一行放置断点,并通过调试器运行代码。然后查看您的代码,并查看您的数据并找出手动应该发生的事情。然后单步执行每一行检查您预期发生的情况正是如此。如果不是,那就是当你遇到问题时,你可以回溯(或者再次运行并仔细观察)以找出原因。


对不起,但是我们不能为你做到这一点 - 时间让你学习一种新的(非常非常有用的)技能:调试!



请看,请看在那段代码中,仔细思考你的名字 是什么意思 - 为什么你有这么近的名字的字符串: text 文本 text2 - 当然还有更多描述性名称吗?并且 num num2 num3 ,...

到底是什么 arg_25_0 arg_6F_0 ......你甚至没有< b> 使用 后者!

使用描述它们的名称,而不仅仅是占位符 - 它使您的代码更容易阅读并且理解(这被称为自我文档)



然后就是你的循环...在实际条件下什么都不做,因为只有变量它被注释掉了。



老实说,我认为你可能会更好地回到起点并重新开始......


据我所知,你的代码什么也没做。

引用:

请有人解决这个问题。谢谢



我们不能!

你忘了告诉我们你的代码应该是什么。

你忘了告诉我们代码是怎么出错的。



提出问题是一项技能 [ ^ ]


Please someone fix this. thank you

public static string Decrypt(string Text)
        {
            int num = 0;
            string text2;
            int num5 = 0;
            try
            {
                num = 1;
                int num2 = 2;
                string text = "";
                num2 = 3;
                long arg_25_0 = 1L;
                long num3 = Text.Length;
                checked
                {
                    for (long num4 = arg_25_0; num4 <= num3; num4 += 1L)
                    {
                        num2 = 4;
                        //text += Convert.ToString(Convert.ToChar(Strings.Asc(Strings.Mid(Text, (int)num4, 1)) - 1));
                        num2 = 5;
                    }
                    num2 = 6;
                    text2 = text;
                }
                int arg_6F_0 = num5 + 1;
                num5 = 0;
                num5 = num2;
            }
            }


[edit]Code block added - OriginalGriff[/edit]

What I have tried:

nothing really......................................................................

解决方案

Look at the code sequence:

int num2 = 2;          // set num2
string text = "";
num2 = 3;          // set num2
long arg_25_0 = 1L;
long num3 = Text.Length;
checked
{
    for (long num4 = arg_25_0; num4 <= num3; num4 += 1L)
    {
        num2 = 4;          // set num2
        //text += Convert.ToString(Convert.ToChar(Strings.Asc(Strings.Mid(Text, (int)num4, 1)) - 1));
        num2 = 5;          // set num2
    }
num2 = 6;          // set num2
num5 = 0;
num5 = num2;


all those hard coded assignments of num2, make it impossible to understand what the code is supposed to be doing. It really looks like you wrote it with your eyes closed.


Quote:

Please someone fix this. thank you


We can't - we have no idea what is wrong with it!
In addition, we don't know what it should do, what it actually does, or any idea of data to input that we could test it with, much less appropriate output to compare against when it's done.

So, its going to be up to you.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!

And please, look at that code and think hard about what your names mean - why have you got strings with such close names: text, Text, and text2 - surely there are more descriptive names for them? And num, num2, num3, ...
What the heck are arg_25_0 and arg_6F_0 ... and you don't even use the latter!
Use names that describe what they are there for, not just "placeholders" - it makes your code a lot easier to read and understand (this is called "self documentation")

Then there is your loop...which does nothing at all in practical terms given that the only "variable" bit of it is commented out.

To be honest, I think you may be better going right back to the beginning and starting again...


As far as I can see your code is doing nothing.

Quote:

Please someone fix this. thank you


We can't !
You forgot to tell us what is supposed to do your code.
You forgot to tell us how the code go wrong.

Asking questions is a skill[^]


这篇关于需要帮助修复此#C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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