c未声明。由于它的保护级别,它可能无法访问。 [英] c is not declared. It may be inaccessible due to it's protection level.

查看:124
本文介绍了c未声明。由于它的保护级别,它可能无法访问。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在做一个Caesar密码项目,但我唯一的错误是我的代码中的'c'请帮忙。

Public Class Form1

解决方案

你的意思是这样做吗

函数Caesar_Cipher(ByVal Text as String ,ByVal I As Integer,ByVal Encrypt As Boolean)As String 
Dim Outcome As String =""
Dim n As Integer

For Each c As Char In Text
If Encrypt Then
n = Asc(c)+ I
Else
n = Asc(c)+ 26 - I
结束如果
如果Char.IsLower(c)那么
如果n> Asc(" z")然后
n - = 26
结束如果
结果+ = Chr(n)
ElseIf Char.IsUpper(c)那么
如果n > Asc(" Z")然后
n - = 26
结束如果
结果+ = Chr(n)
否则
结果+ = c
结束如果
下一个


返回结果
结束功能


Hi guys, I am doing a Caesar cipher project but the only error I had is with the 'c' in my code please help.

Public Class Form1

解决方案

Did you mean to do this

Function Caesar_Cipher(ByVal Text As String, ByVal I As Integer, ByVal Encrypt As Boolean) As String
    Dim Outcome As String = ""
    Dim n As Integer

    For Each c As Char In Text
        If Encrypt Then
            n = Asc(c) + I
        Else
            n = Asc(c) + 26 - I
        End If
        If Char.IsLower(c) Then
            If n > Asc("z") Then
                n -= 26
            End If
            Outcome += Chr(n)
        ElseIf Char.IsUpper(c) Then
            If n > Asc("Z") Then
                n -= 26
            End If
            Outcome += Chr(n)
        Else
            Outcome += c
        End If
    Next


    Return Outcome
End Function


这篇关于c未声明。由于它的保护级别,它可能无法访问。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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