Introduction%20to%20Computer%20Science - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction%20to%20Computer%20Science

Description:

/ / – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 29
Provided by: Shyh4
Category:

less

Transcript and Presenter's Notes

Title: Introduction%20to%20Computer%20Science


1
???????
  • ???
  • ??????
  • ??????/???????/
  • ???????????

2
?? UsingVariable
  • using System
  • class UsingVariable
  • static void Main()
  • char strMyString 'a'
  • int intMyInt 123
  • float fMyFloat
  • Console.WriteLine( strMyString )
  • Console.WriteLine( intMyInt )
  • fMyFloat 123.456f
  • Console.WriteLine( fMyFloat )
  • Console.ReadLine()

3
Main Memory
J. G. Brookshear, Computer Science An
Overview, 8th edition, Addison-Wesley, 2005
4
????
  • ?????????
  • ????
  • ????
  • ????
  • ????
  • ??????
  • ?? (Assignment) ???? (Initialization)
  • ????

5
????? VC .NET 2003
  • ??/?????
  • ????
  • ????, ????, ???
  • ????
  • ?????
  • ??
  • ????
  • ????
  • ???????

6
????? VC 2005 Exp.
  • ??/???/?????
  • ??
  • ????, ???
  • ????
  • ?????
  • ??/??????
  • ????
  • ????

7
?? UsingConstant
  • using System
  • class UsingConstant
  • static void Main()
  • int myInt 123
  • const int MY_CONST 456
  • Console.WriteLine("??myInt 0 ",
    myInt)
  • Console.WriteLine("??MY_CONST 0 ",
  • MY_CONST)
  • myInt 321
  • Console.WriteLine("??myInt 0 ",
    myInt)
  • Console.ReadLine()

8
????
  • ????
  • ????
  • ???????

9
????
  • ????(Value Type)
  • ??(Structs)
  • ??(Numeric)
  • ??(bool)
  • ?????Structs
  • ??(Enumerations)
  • ????(Reference Type)
  • ??(string)
  • ??(Object)

10
?? UsingNumeric
  • using System
  • class UsingNumerics
  • static void Main()
  • int x 256
  • byte y 255
  • Console.WriteLine("x " x)
  • Console.WriteLine("y " y)
  • double z 123.45
  • float f 123.45f
  • Console.WriteLine("z " z)
  • Console.WriteLine("f " f)
  • decimal d 123.45m
  • Console.WriteLine("d " d)

11
????
  • sbyte -128 127
  • byte 0 265
  • short -32768 32767
  • unshort 0 65536
  • int -2147483648 2147483647
  • uint 0 4294967295
  • long -9223372036854775808 9223372036854775807
  • ulong 0 18446744073709551615
  • char U0000 Uffff

12
?????
  • float 7 ????, ??1.5e-45 3.4e38, 32 ??
  • double 1516????, ??5.0e-324 1.7e308, 64 ??

0
13
decimal ??
  • 28 29 ???, ??1.0e-28 7.9e28 (?), 128 ??

14
?? UsingChar (1/2)
  • using System
  • class UsingChar
  • static void Main(string args)
  • char theChar1 'a'
  • char theChar2 '?'
  • char theChar3 '\x0059'
  • char theChar4 '\u0058'
  • char theChar5 '\n'
  • char theChar6 '\''
  • Console.WriteLine(theChar1)
  • Console.WriteLine(theChar2)
  • Console.WriteLine(theChar3)

15
?? UsingChar (2/2)
  • Console.WriteLine(theChar4)
  • Console.WriteLine(theChar5)
  • Console.WriteLine(theChar6)
  • Console.ReadLine()

16
????
  • ASCII vs. Unicode
  • ?????Unicode???
  • ????( Escaped character )
  • \a ??(alarm)
  • \b ??(backspace)
  • \ ???(apostrophe)
  • \\ ???(backslash)
  • \t ????(tab)
  • \n ??(next line)

17
????
  • ????, ????
  • x gt 1
  • true/false, ???????1 ? 0

18
??
  • ?????,????????????,?????

19
?? Conversion (1/2)
  • using System
  • class Conversion
  • static void Main(string args)
  • int a 10
  • double b 0
  • b a
  • b 20.5
  • a (int)b
  • Console.WriteLine("a " a)
  • Console.WriteLine("b " b)
  • float c 20
  • c 20.5f
  • c (float)20.5

20
?? Conversion (2/2)
  • Console.WriteLine("c " c)
  • char d (char) 65
  • Console.WriteLine("d " d)
  • Console.ReadLine()

21
?????????
  • ???? (Assignment)
  • ???? (Implicit conversion)
  • ???? (Explicit conversion)

22
?? UsingEnum (1/2)
  • using System
  • class UsingEnum
  • enum WeekDay
  • SUN 1,
  • MON 2,
  • TUE 3,
  • WED 4,
  • THU 5,
  • FRI 6,
  • SAT 7

23
?? UsingEnum (2/2)
  • static void Main(string args)
  • Console.WriteLine(
  • "????????0?!!", (int)WeekDay.SUN)
  • Console.WriteLine(
  • "????????0?!!", (int)WeekDay.MON)
  • Console.WriteLine(
  • "????????0?!!", (int)WeekDay.TUE)
  • Console.ReadLine()

24
???? (Enumeration)
  • ???????????
  • ??????
  • ??????

25
?????
  • string stringValue1 abc
  • string stringValue2 a
  • char charValue a

26
??(Stack)???(Heap)
. . .
Stack
27
????????
??(Stack)
int x 100
100
x
28
????????
??(Heap)
??(Stack)
string x abc
a
??
x
b
c
Write a Comment
User Comments (0)
About PowerShow.com