. , .
: a b, c.
:
1. a b;
2.
;
3. c.
Microsoft Visual Studio . . Main, .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double a, b, c;
Console.Write(" a=");
a = double.Parse(Console.ReadLine());
Console.Write(" b=");
b = double.Parse(Console.ReadLine());
c = Math.Sqrt(a*a + b*b);
Console.WriteLine(" c={0}", c);
Console.Write(" ... ");
Console.ReadKey(true);
}
}
}
(Save All) (File).
F5.
. . 1.8.
1)
using System;
, System. C#.
System .
2)
namespace ConsoleApplication1
(namespace , , ConsoleApplication1 ). Visual studio . {( , ), } ( ).
3) ConsoleApplication1 Program (class , , Program ):
class Program
. . . C# . . .
C#. , Program .
|
|
4) Program Main(). :
static void Main(string[] args)
. Main() C#. C#. Main() .
, . . . . . Main() .
3 .
double a, b, c;
. double ( ), , a b .
2)
Console.Write(" a=");
-. , .
a=
( a).
3)
a = double.Parse(Console.ReadLine());
a , . ? , : 3, , . ReadLine() Console. , . Parse() double double. a.
: double C#, , . . (C, Pascal, Basic) .
.
Console.Write(" a=");
a = double.Parse(Console.ReadLine());
a , , , . :
a=3
4)
Console.Write(" b=");
b = double.Parse(Console.ReadLine());
b. , a.
5)
c = Math.Sqrt(a*a + b*b);
c. = Sqrt(), Math. Sqrt() .
6)
Console.WriteLine(" c={0}", c);
|
|
c=5
, WriteLine(), , , c.
{0}, . 0. c.
? C# :
C# , , , ( ) . , . ..
, , 1.5.
1.5
, , ( 1.6).
1.6
, . , .
1. .
2. .
3. .
4. .
5. .
6. .
7. .
8. .
9. .
10. .
11. .
12. .
13. .
14. .
15. .
16. .
17. .
18. .
19. .
20. .
: .
;
;
;
;
;
( , ).
.
1. Microsoft Visual Studio?
2. Microsoft Visual Studio?
3. Microsoft Visual Studio ? ?
4. ?
5. ?
7. ?
8. ?
9. ?
10. #?
11. () ?