zoukankan      html  css  js  c++  java
  • c# 用户输入一个字符串,求字符串的长度

    C#  用户输入一个字符串,求字符串的长度使用字符串的length;

     1  class Program
     2     {
     3         static void Main(string[] args)
     4         {
     5             Console.WriteLine("请输入一句话:");
     6            string str= Console.ReadLine();
     7            int count= StrLength(str);
     8             Console.WriteLine(count);
     9             Console.ReadKey();
    10 
    11         }
    12         /// <summary>
    13         /// 获取用户输入的字符串长度
    14         /// </summary>
    15         /// <param name="str"></param>
    16         /// <returns></returns>
    17         private static int StrLength(string str)
    18         {
    19             return str.Length;
    20         }
    21     }
    View Code
  • 相关阅读:
    货币系统
    纸牌
    活动
    KKT-黑白球
    POJ2676-Sudoku
    POJ1717-Dominoes
    POJ1088-滑雪
    POJ1862-Stripies
    POJ2531-Network Saboteur
    2019.12.13 数的划分
  • 原文地址:https://www.cnblogs.com/zlp520/p/3551326.html
Copyright © 2011-2022 走看看