Using the windows32 or windows64 framework,write a program that uses a dialog bo
ID: 3927870 • Letter: U
Question
Using the windows32 or windows64 framework,write a program that uses a dialog box to input a string of characters into charStr, recalling that the input macro terminates a string with a null bytes (00). Treat this string as an array of characters and determine the length of the string , how many lowercase letters it contains, how many upper case letters it contains , how many lowercase letter its contains, how many digits ('0' to'9') it contains,how many spaces it contains. report these five results in single massage box
Explanation / Answer
Using the windows32 or windows64 framework that i'm considering .Net framework and writing the solution:
using System;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int countedWords = 0;
int capital_c = 0;
int lower_c = 0;
Console.WriteLine("Please enter string ");
string inpstr = Console.ReadLine();
countedWords = inpstr.Split(' ').Length;
Console.WriteLine(" REPORT FOR: " + inpstr + " ");
Console.WriteLine("wordcount: " + countedWords);
foreach (char c in inpstr)
{
if (Char.IsUpper(c))
capital_c++;
else if (!char.IsPunctuation(c) && !char.IsWhiteSpace(c))
lower_c++;
}
Console.WriteLine("number of letters: " + (capital_c + lower_c));
Console.WriteLine("number of capital letters: " + capital_c);
Console.WriteLine("number of lower case letters: " + lower_c);
Console.WriteLine("number of spaces: " + (countedWords - 1));
Console.ReadLine();
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.