.


:




:

































 

 

 

 


,

-

() . .

 

 

 

 

,

 

()

2016


51:512(076.5)

22.1 73

 

 

, ,

 

 

..

 

: , / - () . . . - : (), 2016. 27.

. C C++, -, , . , , - . , , - , , , , , C#.

, : 02.03.03 , 09.03.04 .

 

51:512(076.5)

 

ã - () .. , 2016


,

-
1 C 2 26.09-30.09 [1-5]
2 C 2 3-08.10 [1-5]
3 C 2 10-14.10 [1-5]
4 - 2 17-20.10 [1-5]
5 , 2 24-27.10 [1-5]
6 C 2 07-14.11 [1-5]
7 - C++ 2 21-25.11 [1-5]
8 C++ 2 05-10.12 [1-5]
9 . C# 2 19-23.12 [1-5]

 

1

C

 

1. C, :

#include <stdio.h>

int main()

{

printf("Hello, world!");

getchar();

return 0;

}

 

2. :

#include <stdio.h> // -

int main() //

{

printf("Hello, world!"); //

getchar(); //

return 0;

}

 

2

C

 

1. :

int lower, upper, step;

float eps = 1.0e-05;

int i = 0;

float eps = 1.0e-5;

const double = 2.71828182845905; //

int i,j,l; short int si; unsigned int ui; double balance, profit, loss;

2. , , , :

#include <stdio.h>

int main()

{

int a = 9,b = 4, c;

c = a+b;

printf("a+b = %d \n",c);

c = a-b;

printf("a-b = %d \n",c);

c = a*b;

printf("a*b = %d \n",c);

c=a/b;

printf("a/b = %d \n",c);

c=a%b;

printf( b = %d \n",c);

return 0;

}

 

3. /, , , :

#include <stdio.h>

int main()

{

int a = 10, b = 100;

float c = 10.5, d = 100.5;

printf("++a = %d \n", ++a);

printf("--b = %d \n", --b);

printf("++c = %f \n", ++c);

printf("--d = %f \n", --d);

return 0;

}

4. , , , :

#include <stdio.h>

int main()

{

int a = 5, b = 5, c = 10;

printf("%d == %d = %d \n", a, b, a == b); // true

printf("%d == %d = %d \n", a, c, a == c); // false

printf("%d > %d = %d \n", a, b, a > b); //false

printf("%d > %d = %d \n", a, c, a > c); //false

printf("%d < %d = %d \n", a, b, a < b); //false

printf("%d < %d = %d \n", a, c, a < c); //true

printf("%d!= %d = %d \n", a, b, a!= b); //false

printf("%d!= %d = %d \n", a, c, a!= c); //true

printf("%d >= %d = %d \n", a, b, a >= b); //true

printf("%d >= %d = %d \n", a, c, a >= c); //false

printf("%d <= %d = %d \n", a, b, a <= b); //true

printf("%d <= %d = %d \n", a, c, a <= c); //true return 0;}

3

C

 

1. , . :

double d; //

long l; //

int i; //

if (d > i) d = i;

if (i > l) l = i;

if (d == l) d *= 2;

 

2. , , :

#include <stdio.h>

int main(void) {

int i_value = 16777217;

float f_value = 16777216.0;

printf(" integer:%d\n", i_value);

printf(" float: %f\n", f_value);

printf(" :%s\n", i_value == f_value?"":"");

return 0;

}

3. - :

int X;

int Y = 200;

char C = 30;

X = (int)C * 10 + Y;

printf("X=%d",X);

 

4

-

 

 

1. , 10 , .

2. , , , .

3. , :

int main() {

int x = 4, y = 6, k = 5, i = 1;

y*=x+=--k<<++i;

printf("y =%d, x =%d, k =%d, i =%d\n", y, x, k, i);

return 0;

}

 

5

,

 

1. for.

2. :

int i;

for (i = 0; i < 10; i++) {

printf("%d\n", i);

}

getchar();

3. , do...while.

6

C

 

 

1. 10 .

2. :

#include <stdio.h>

int main()

{

int avg = 0;

int sum =0;

int x=0;

int num[20];

for (x=0; x<=19;x++)

{

num[x]=x+1;

}

for (x=0; x<=19;x++)

{

sum = sum+num[x];

}

avg = sum/20;

printf("%d", avg);

return 0;

}

3. .

7

- C++

 

 

1. , , , .

2. .

3. , , .

 

8

C++

 

 

1. , , , .

2. .

3. , .

 

9

. C#

 

 

1. C#, , , , .

2. C#, , .

3. .

 




<== | ==>
- | ,
:


: 2018-10-15; !; : 217 |


:

:

, ,
==> ...

1558 - | 1537 -


© 2015-2024 lektsii.org - -

: 0.048 .