i m having a problm in writing a program that takes a character from the user and displays whether the character entered is uppercase or a lower case or a symbol.. plx help..
You can take the character from the user then cast it to an int. That will give its ASCII value which you can use a table to look up. Something like this:
Code:char c = Console.ReadLine(); int asciiValue = (int)c; //Then use if statements to check the value.
so it be likethats C++ Pseudocode but i'm sure its similar in C if thats what you are usingCode:if(c <=90 && c >= 60){ //code if uppercase } else if(c <= 122 && c >= 97){ //code if lowercase} else { //code if symbol or number} //code
Yea Dat's right.
Apple sucks
if i understand corectly this sample should help. Without ascii.
Code:using System; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main() { while (true) { while (!Console.KeyAvailable) Thread.Sleep(250); var read = Console.ReadKey(true).KeyChar.ToString(); if (IsExitKey(read)) return; if (IsUpperCase(read)) Console.WriteLine("upper"); else Console.WriteLine("lower"); } } private static bool IsExitKey(string read) { return read.ToUpper() == "X"; } private static bool IsUpperCase(string read) { return read.ToUpper() == read; } } }
wow I didn't know C# was that different, it kinda reminds me of java
Yea Dat's right.
Apple sucks
too bad it's not portable or i might give it a shot.
Yea Dat's right.
Apple sucks
Two cheers for Mono :-)
Main Page - Mono
Nice, maybe someday i'll give it a shot. but for now I'm too lazy.
Yea Dat's right.
Apple sucks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks