Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
130 views
in Technique[技术] by (71.8m points)

c# - How to capitalize all letters of a string and count all its characters, using a do...while?

I am really struggling in this i tried many codes but i failed every time i am not asking to solve my homework but just help me how to start or the way to solve this.

3.1 ShowStringLength(): The method prompts the user to provide a text and the program displays the same text but in capital letters, as well as the number of characters including the spaces in the text.

Requirement: Use a do-while-statement: This part is repeated until the user presses Enter key directly at the prompt without giving any text.

This what i start with but i failed with the Requirement and I am not able to count number of chars.

Console.WriteLine("let me calculate the length of strings for you ");
Console.WriteLine("give me a text of any length, or press enter to exit");

string inputString = Console.ReadLine();
string upperstr1 = inputString.ToUpper();

Console.WriteLine(upperstr1);
private void Calculatenumber()
{
  string inputString = Console.ReadLine();
  int k = inputString.Length;
}
question from:https://stackoverflow.com/questions/65922661/how-to-capitalize-all-letters-of-a-string-and-count-all-its-characters-using-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...