.NET Console. : , . -, : , . .
: public static class Console
:
System.Object
System.Console
: System
:
Beep() .
Clear .
OpenStandardError() .
Read .
ReadKey() . .
ReadLine .
Write(Boolean) .
Write(Char) .
WriteLine() .
4 : Read, ReadLine, Write WriteLine. , - .
int nChar = 0x044F 0x0410 + 1;
char[] chars = new char[nChars];
ushort codePoint = 0x0410;
for (int ctr = 0; ctr < chars.Length; ctr++)
{
chars[ctr] = Convert.ToChar(codePoint);
codePoint++;
}
Console.WriteLine(Current code page: {0}\n, Console.OutputEncoding.CodePage);
foreach (var ch in chars)
{
Console.Write({0}, ch);
If (Console.CursorLeft >= 70)
Console.WriteLine();
}
- (Read, ReadLine, Write, WriteLine). . , , .
Console, System.
Read
Read . int, , -1, . :
do{ int i = Console.Read(); if (i!= -1) Console.WriteLine("{0} ({1})", (char)i, i); else break;} while (true);.
ReadLine
ReadLine ( ). string null, .
do{ string s = Console.ReadLine(); if (s!= null) Console.WriteLine(" : " + s); else break;} while (true);Write WriteLine
Write . . , Write :
|
|
. , , "{n}" n- ( 0):
Console.Write(", {0}", Name);WriteLine Write , .
17. . . Convert, , . Parse, , .
, , . .
, . . , . , byte int , byte int. . , . , , , long double .
, . . int byte , .
:
String astr, bstr;
astr=Concole.ReadLine();
bstr=Concole.ReadLine();
int a, b;
a=Convert.ToInt32(astr);
b=Convert.ToInt32(astr);
Parse
(, , ) Parse, , - . , . , , , . , .
String astr, bstr;
astr=Concole.ReadLine();
bstr=Concole.ReadLine();
int a, b;
a=int.Parse(astr);
b=int.Parse(bstr);