24665人加入学习
(72人评价)
C#编程-第一季-编程基础-宇宙最简单2021最新版

制作完成于2021年10月10日,使用Visual Studio 2019

价格 免费

string str = console.readline( );

int[] countarray=new int[26];

for(int i = 0; i < str.length; i++)

{

     countarray[str[i] - 'a' ] = countarray[str[i] - 'a' ] + 1;

}

bool is find = false;

char c = '  ';

for(int i = 0; i < str.length; i++)

{

     if(counarray[str[i] -'a'] == 1)

          {

               isFind = true;

               c = str [i];

          }

}

 

[展开全文]

string str = Console.ReadLine();

int[] countArray = new int[26];

for(int i =0;i<str.Length;i++)

{
    countArray[str[i]-'a']=countArray[str[i]-'a']+1';

}

bool isFind = false;

char c=' ';
for(int i = 0;i< str.Length; i++){
        if(countArray[str[i] - 'a']==1){
                 isFind = true;

                  c = str[i];

                  break;
}
}
if (isFind== false){
Console.writeLine(no");
}
else{
Console.Writeline(c;
}
 

[展开全文]
 static void test06()
        {
            string str = Console.ReadLine();
            int[] countArray = new int[26];
            for (int i = 0; i < str.Length; i++)
            {
                countArray[str[i] - 'a'] = countArray[str[i] - 'a'] + 1;
            }
            for (int i = 0; i < countArray.Length; i++)
            {
                Console.Write(countArray[i]+" ");
            }
            bool isFind = false;
            char c = ' ';
            for (int i = 0; i < str.Length; i++)
            {
                if (countArray[str[i] - 'a'] == 1)
                {
                    isFind = true;
                    c = str[i];
                    break;
                }
            }
            Console.WriteLine();
            if (isFind==false)
            {
                Console.WriteLine("no");
            }
            else
            {
                Console.WriteLine(c);
            }
            
        }

 

[展开全文]

            //找出字符串中第一个仅出现一次的字符
            string str = Console.ReadLine();
            bool isOnlyOne = false;
            for (int i = 0; i < str.Length; i++)
            {
                if (str.IndexOf(str[i]) == str.LastIndexOf(str[i]))
                {
                    isOnlyOne = true;
                    Console.WriteLine($"第一个仅出现一次的字符是:{str[i]}");
                    break;
                }
            }
            if (isOnlyOne == false) Console.WriteLine($"所有字符均出现两次及以上");

[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(118)
图文(1)