.


:




:

































 

 

 

 


ң қғң ұғ . ң ө қғң ң ң




#include <conio.h>

#include <stdio.h>

#include <math.h>

main()

<

float a;

float v,s;

print f(a ө ң);

scanf (a=%f,&a);

v=pow(4,3)

s=pow(a,2)

printf(ң ө ә : v=%6,3f, s=%7,3,\n,V,S);

getch();

>

 

1. ң . қ . ; ң қ ө . Өң ү , ; . ң ү . ң :<> = <> <> <ө>;ұ ққ ғ :<> <> = <ө>;ө .a=a+b; a+=b; a=a*b; a*=b;a=a-b; a-=b; a=a/b; a/=b; ғ қғ . :sum = a = b;ұ ң ғ қ , ғ b-ң ә a-ғ , -ң ә sum-ғ . ғ :1) a = (b = 1) +2; ұ a=3, b=1.2) a = b = 1 + 2; ұ a = 3, b = 3.өң қғ ғ қғ ә ө , : ((s=13+12)<=30) ө ққ ә .

 

2.ң ү ә ғ ғ ң ү қ ө ? қ ү ғ setcolor(col);ұғ ol ү ү . қ ә ә ү . қ setlinestyle() қ ғ.ү ү ү ү ә ғ ү . : setcolor(YELLOW); setcolor(3); setcolor(5);ң ү ө setbkcolor (ү);: setbkcolor(BLUE); setbkcolor(14);үң ө:

ө ү қ ү
Қ (BLACK)   Қ ққ (DARKGRAY)  
ө (BLUE)   ө (LIGHTBLUE)  
(GREEN)   қ (LIGHTGREEN)  
ө (CYAN)   қ ө (LIGHTCYAN)  
Қ (RED)   Қғ (LIGHTRED)  
ү (MAGENTA)   Қғ (LIGHTMAGENTA)  
Қң (BROWN)   (YELLOW)  
ұ (LIGHTGRAY)   қ (WHITE)    

 

ҳұ үұң . ң ң

#include <conio.h>

#include <stdio.h>

#include <math.h>

main()

<

float a,b; float c,S;

clrscr();

printf(үұ a ә b қ ;);

scanf (%f%f,&a,&b);

pow(c,2)=pow(a,2)+pow(b,2)

S=(a*b)/2

printf(ұ :c=%3,2f, ұ :s=4.2f, c,S);

getch()

>

1.Printf ә scanf . қ ә <stdio.h> -ғ қ . қ : #include <stdio.h> printf() ә ғ ғ ү қ. ң ү:printf(< >,< >);(< > ққ () , ң қ ө ұ, ғ (ғ) ғ қ ә ү, % ә ә , ү ә ө ә . , , ө қ ү. scanf() ғ қғ ү ң ө . scanf (< >,< >); ұқ . : scanf("%d%f", &x,&y);

 

2.Құ (). Құ қ, ,

. құ ө қ қ әү ә . әң құқ қ:

struct құ_

{

;

};

Құғ ө ү құқ қ :struct құ_ _;

Құ қ ң қ ә . Құ ң ә ү ғқ cin>> scanf қ.Құ ғ :1) Құң . Құң ү құқ ғ ұқ (&) қ. 2) Құң ү ү (.) ( ) (->) (ұқ ) қ. Құқ float, int, char қ ү. :

struct gr /* құ */

{char fio[10]; /* құ */

int est[25]: /* құ */

int nomer; /* құ */

}

gruppa1; /*құқ */

struct gr gruppa2; /* құқ */

құ ғ қ ң , құ ғ қ . Құқ қ ғ ғқ ә

9

1. ә . ұ әң қ. : char (8 ) қ, ғ ңқ , short ққ ү , int ү , long ү , unsigned ң ү , float қ , ғ ү , double қ , long double ұғ, ә қ .ғқ ө ү ү қ.

ң құғ ә ң

(ұғ) 2.5

ә Ұғ ( )
Char 8 1 -128... +127
unsigned char 8 1 0... 255
short int 16 2 -32768... 32767
unsigned short 16 2 0... 65 535
int 16 4 -32768... 32767
unsigned [int] 32 4 0... 4294967295
Long 32 4 -2 147 483 648... 2 147 483 647
unsigned long 32 4 0... 4 294 967 295
Float 32 4 3.4×10-38... 3.4×1038
Double 64 8 1.7×10-308... 1.7×10308
long double 80 10 3.4×10-4932... 3.4×104932

 

2.ғ ұқ. ұқ әң қ . ғ, ұқ ң қ . Қ &sum sum ғ ұқ . қ ұ, &sum ұқ . ұқ . ұқ ә ң . , ұқ ptr қ , ө sum ң ptr ұқ ғ . ptr ұқ қ ү. :int *ptr;ptr=&sum; ptr=&max;* қ қ ү . , ptr ұқ max ұқ қғ . ң ә ү * қ қғ . ptr ұқ ә қ ү қ: res=*ptr;

10-

ң қ .1. ң қ ө . 1. ҳ ү ө ( keyword) құ ү қ . ұ қ ғ ң ә ә . қ , ә ө ү қ ә ә , , ә ү .2. Ққ () ң ә ә ө ү ә . 3. ң, , қ ң ә . 4. қ ә . ұ қ: , , ң ғ ө, ң ө ң . ұ ұ қғ - ү қ. 5. ө қ қ ә ғ қ . қ ө қ (\) ә ұ. 2. ҳң қ . ҳң қ , , , ә , ө ұғ . ғ ң ә볭ң қ, қ қ () ә . ұ қ ү ғ ұқ . ұ ә ү ә (қ ә, қ ә, ...) қ ү, қ ң ұғ .. ү ә қ ө. ү : +4, -100, 15743, 0 ... Қ ү қ ү (ғ NTEGER) -32768 +32767 ғ ғ

 

2.

 

 

3.1- N- ii ң қ i құң. N-iң әi қ iii

#include <stdio.h>

#include <conio.h>

main()

<

int s=0,I;

clrscr()

printf (1- n- ң қ=);

for(i=1; i<=n; i++)

S+=i;

printf (S=% d, s);

printf (\n қ ү Enter ң\n);

getch();

>

11-.

1.Ққ ң ?

ққ , :

if (1-)

1-;

else if (2-)

2-;

else

3-;

ұ 1- ққ , 1- , 1- ғ , 2- ққ , 2- , 1- ә 2- ғ , 3- қ.

2. -ғ (scanf(), printf(), puts(), gets(), putchar(),getchar())?

printf() ә ғ ғ ү қ. : printf ( ң ә = %f\n, pi);

printf() ғ қ ө ғ.

printf ( ң ә = %f\n, pi);

ү scanf() gets()қ, ң stdio.h ққ .

: scanf("%d%f", &x,&y);

/ғ ү printf() ә scanf() ң %c қ.

getch() , ғ ң (int) , ғ қ ғ.

getchar() . - . ө <Enter> ғ , ғ ө .

putch(c) (c cқ ), ғ ң ғ ғ ғ.

putchar(c) ұ ң ғ ғ. ұ conio.h қ ұ .

puts(str) ғ ө ғ, ң .

3.1- N- ii ң өiii i құң. N-iң әi қ iii

#include <iostream.h>

int main ()

<

int i=0, n;

int sum=1;

while (i<n);

< i++

Sum+=I;

>

Cout<<1- - =<<sum<<end;

>

12-.

1. ?

(?:) ө ғ ү , ғ қ ә ү ә қ ө құ. ұ ү . ң ( ) ққ , ө ә қ ң; ғ , ү ң. : max_ab = a > b? a: b;

2. қ ә ө (). қ ұ ?

қ ү қ, ө char ұ () қ. қ ө ұқ қ , ң ң \o ұ. ң ұғ қ ү strlen() қ.

#define ұ қ қ қ.

ө char ө қ, ғ ө ө қ char ө . ө қ ө ң , ´ \0 ´ қ қ ( ң ө-). қ k , k+1 ө .

(қ) қ қғ ғ . , , ң ң ө ү ө .

ү scanf() gets()қ, ң stdio.h ққ

 

13-.

1.ө ұқ ң ү қ? ң қ?

ұқң ң ғ ғ, switch ғ қ. ң ө . ң :

switch <ү ө>;

{

case 1: ;

case 2: ;

................

[default: ;]

}

2. өө ұқ.

ұқ ғң қ . ұқ әң қ . ғ, ұқ ң қ . ұ ұқ қ. ғ ұқ ү :

FILE *fp;

ң . ң қ ө ө ғ .

ө :

void minit(int matrix[][KO],int str);

{

int i,j;

for (i=0; i<str; i++)

for (j=0; j<KO; j++)

matrix[i][j]= rand();

}

3. қ 10 ү ii, ң қң.

#include <conio.h>

#include <stdio.h>

#include <stdio.h>

void main()

<

int A[10];

int i;

printf (enter;);

for (i=1; i<n; i++)

k=pow(n,2)

c=pow(n,3)

printf(k=%6,2i, c=%5.7i, k,c);

getch();

>

 

14-.

1. ң

For ң ғқ, ңғ ә ө қ ғ, ғ ә қ қ. ұ қ .

ң :

 
 

 

 


For ң ү:

for (x=x0; x<=xk; x=x+dx)

{

<1->;

<2->;

...

<n->;

}

 

2. ө ұқ.

ғ қ ө , ү ң қ (ө) ң ө . ө :

int min_index(int sp[], int ras)

{ int i, mindx, m;

mindx=0;m=sp[mindx];

for(i=0; i<ras; i++)

if(sp[i]<m)

{ m=sp[i]; mindx=i;

};

return(mindx);

}

ұқ . , int array[25] ү , ң ү ө ғ , қ ә ң ң (ғ, ө) ң, array ұқ ү ө , ғ, ң ө қ, ң ұқ array ұқ қ ү . ҳ ә array ұқ ұқ , ң ә ө қғ , қ, ұ ә ө . ұқ ғқ, ұқ :

int array[25];

 

int *ptr;

 

ptr=array;

3.ө ә 0- xk-ғ dx қ ө қң

, x 0 =10, x k =30, dx =1.5

#include <stdio.h>

#include <math.h>

#include <conio.h>

main()

<

float x,y,x0,xk,dx;

clrscr();

printf (x-ң қ, ңғ ә;);

scanf (x0f; k0x);

printf(_______________\n);

printf( x y \n);

x=x0;

while(x>=xk)

if x>0;

y=sqrt(absOa-x)*pow(sin(x),2);

else x=4;

y=((x)\abs*(a*x))*pow(abs9sin(x)),1/3);

if else x<a;

y=exp(sqrt(abs(x));

printf(4% 6,2f %6,2f\n,x,y);

x=x+dx;

>printf(_______________\n);

Getch()

>

 

15-.

1. for ң

For ң ғқ, ңғ ә ө қ ғ, ғ ә қ қ. ұ қ . ң :

 

2. ұ (қ , ң)

ұ ң ұ ғ, ө ә қ ғ ә ү . Қ ұ ә n*n , ұғ n ; ұ ә n*ln(n) қ . Қ ә ү ң, ө ү. ү ә ә , ү , қ ғ қ ә қғ ұ. Қ ә 3 қ ө:

- ң ұ;

- ә ұ;

ә ұ.

ң ұ

ң ң қ , . Қғ ә қ. () ә ұ

қ ә ө볭. Ә I=2 ө , қ I- , ң . ұ I- 1 қ , ә қ.

қ ұ

ұ ң ңғ , , қ , . ә ә ң ң ң қ ғ. Қғ ү қ.

 

16-.

1. ң ң .

While

құ ң ү . ң

ң :

while (-ө)

;

 

2. , ғ (қ, , ң ә). .

ң . , ұғ ә . ү ү қ.

ұ (, )

ұ () ұғ қ . ұ ғ ә ү . Қ ұ ә n*n , ұғ n . Қ ә ү ң, ө ү. Қ ә 3 қ ө:

ң ұ;

ә ұ;

ә ұ.

ң ұ

ң ң қ , . Қғ ә қ.

() ә ұ

қ ә ө볭. Ә I=2 ө , қ I- , ң . ұ I- 1 қ , ә қ.

қ ұ

ұ ң ңғ , , қ , . ә ә ң ң ң қ ғ. Қғ ү қ.

ққ. қ қ ғ ү.

 

17-.

1. ң do while ң

ң do while ң ө.

do

{

1-;

2-;

n-;

}

while (ө);

 

 

 

2. ң

ң ұ ә ғ.

ң ү :

if ()

1-;

else

2-;

 

 

қ ә

 

Switch ө ұқ ң . ұқң ң ғ ғ, switch ғ қ. ң ө . ң :

switch <ү ө>;

{

case 1: ;

case 2: ;

................

[default: ;]

}

Default ө , switch .

 

18-.

1. ? ң . , ұғ ә . ү ү қ.

ұ (, )

ұ () ұғ қ . ұ ғ ә ү . Қ ұ ә n*n , ұғ n . Қ ә ү ң, ө ү.

Қ ә 3 қ ө:

ң ұ;

ә ұ;

ә ұ.

ң ұ

ң ң қ , . Қғ ә қ.

() ә ұ

қ ә ө볭. Ә I=2 ө , қ I- , ң . ұ I- 1 қ , ә қ.

қ ұ

ұ ң ңғ , , қ , . ә ә ң ң ң қ ғ. Қғ ү қ.

ққ. қ қ ғ ү.

2. ң құ , ө . , ,

ұ қ ң қ .

құ ;

ң ;

;

ө .

Құ ғ құ ә . ү қғ . құ ғ қғ, . ө . ө ң ұ, қ ғ ө . GOTO (ө) ү ө , LABEL ө ғ ө.

19-.

1. ә

ң қ ө, ., a[20], a[n] ү

#define n 20 ө

const n=20; .

k , k+1 ө .

, char a[7] ң 6 ұ, ңғ ө .

 

2. қ . қ қ .

қ ә ғ ә ң ү ө ү қ ө ү . : 2.65, 0.5, -0.862, -6.0.

ң ә ү ә қ . Ә .

ә
   
147,125 147.125
-6,045 -6.045
12*1014 12+14
-0,52*104 -0.524
5,2*10-12 5.2-12
-45*106 - 456

. .

ә , ә ұ . , a, beta, b5, baga, ... ұқ :

char f;

long z, t;

int a, beta, baga;

float b5, k, n;

int y = 10;

Қ :

char short int long float double

 

20-.

1. ә ғ ғ

ө rand() ә random() , қ қ ңғ .

ү ү қ. ө 10 0- 9-ғ , ғ ғ ғ ө:

main ()

{

int ia[10];

int index;

for (index = 0; index <10; index ++)

ia[index] = index;

for (index = 9; index >=0; index --)

printf( %i, ia[index]);

 

 

2. ү . ғ қ қ ә қ

Int ү ө a,b,c ң ү ә қ, float ү ө p,s ң қ ә қ ұ.

ү ә қ ө. ү : +4, -100, 15743, 0 ... Қ ү қ ү (ғ NTEGER) -32768 +32767 ғ ғ , ұ ү қ ғ .

ң ә ү ә қ . Ә . .

ә , ә ұ . , a, beta, b5, baga, ... ұқ :

char f;

long z, t;

int a, beta, baga;

float b5, k, n;

int y = 10;

Қ :

char short int long float double

 

21-

1-. өң ң ү

өң ө ңғғ ө ү ө.

ң 1-ү ң ғ ө ә өң .

ң 2-ү () ң ө ә .

ң 3- қ өң ң қ ө - өң ә . ә өң ә ү ә ү өң.

ң 4- ң ғ ң , ғ .

 

2-. қ ?

ұ ә . Ә ғ ү ә , . қ 1 . Char signed ә unsigned қ. Signed char 128.. 127. Unsigned char қғ, ң ә 0.. 255 . ү ASCII (American Standard Code for International Interchange) ғ. ң 0.. 31 қ , -ғ ғ қ. har ң ү ү қ қ, қ ң ө ө ү қ .

 

22-

1-. ң ң ү (ң ) қ

ң ң ү қ .

//

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

void main()

{

int a[100];

int n;

printf("\nEnter the size of array:", n);

scanf("%i",&n);

for(int I=0;I<n;I++)

{ a[I]=rand()%100-50;

printf(" %i ", a[I]);

}

int max=a[0];

for(I=1;I<n;I++)

if (a[I]>max) max=a[I];

printf("\nMax= %i", max);

getch();

}

 

2-. Ө. ң

ө ә ү қ , қ ө . қ ө : + - * / % . ө ә ғ қ қ. Ө :

= +1; k = 5.35; x1= (-b+sqrt(b*b-4*a*c))/(2*a);

y = sqrt(sin(x)+1); c = 2*p*r; R = 19.36;

Қ ң қ қ ө ә қ ққ (0- ң ) ғ (0- ң) . қ қ ү , ++ .

 

23-

1-. қ

ү ң ә ұ a[n] ң ұ ө ң қ , ұ n , ң ә қ ү ұ.

rand() 0...32767 ғғ ү . ү stdlib.h , ғ қ қ қ. ң ә ұ ү ғ қ 100- ө, қғ 50 ғ.

/*ң ұ i қ*/

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

main()

{

int a[50];

int n;

printf("\n ? ");

scanf("%d",&n);

printf(" i:\n");

for(int i=0;i<n;i++)

{

a[i]=rand()%100-50;

/* ғ 0 - 50 ғғ қ i */

printf("%d, ",a[i]);

//

}

int sum=0;

for(i=0;i<n;i+=2)

sum+=a[i];

// 0, 2, 4... i i қ

printf("\nң ұ i қ: %d",sum);

getch(); // әi қ, ө үii

}

 

2-. ң қ

ұқ ң ә ө қ . ҳ , , қ, ү, қ , ..

Қ :

char short int long float double

ғқ ө ү , ңғ қ ө, char () .

ұ әң қ. :

char (8 ) қ, ғ ңқ ,

short ққ ү ,

int ү ,

long ү ,

unsigned ң ү ,

float қ , ғ ү ,

double қ ,

long double ұғ, ә қ .

ғқ ө ү ү қ. ө ә ү ң ұқ ө.

24-

1-. ң -

ң - ү қ ғ . , a[I] ә a[J] ң ү қ R :
R=a[I]; a[I]=a[J]; a[J]:=R;

4-. ң қ ұғ : 1 ә 2, 3 ә 4, 5 ә 6, ... -

for(int i=0;i<n-1;i+=2)

{int r=a[i];

a[i]=a[i+1];

a[i+1]=r;}

 

2-. ң ү ө

ү ө ғ қғ , ң . ұ , , ө ң ү ө , ө ғ ғ қ.

ү ө .

auto double int struct break else long switch

register tupedef char extern return void case float

unsigned default for signed union do if sizeof

volatile continue enum short while

ұғ қ ү ө қ ғ қ.

 

25-

1-. ұ

ұ () ұғ қ . ұ ғ ә ү . Қ ұ ә n*n , ұғ n ; ұ ә n*ln(n) қ . Қ ә ү ң, ө ү. ү ә ә , ү , қ ғ қ ә қғ ұ. Қ ә 3 қ ө:

ң ұ;

ә ұ;

ә ұ.

 

2-. ң ,

ң қ ө .

1. ҳ ү ө ( keyword) құ ү қ (1 ). ұ қ ғ ң ә ә . қ , ә ө ү қ ә ә , , ә ү .

2. Ққ () ң ә ә ө ү ә .

3. ң, , қ ң ә .

4. қ ә . ұ қ: , , ң ғ ө, ң ө ң . ұ ұ қғ - ү қ.

5. ө қ қ ә ғ қ . қ ө қ (\) ә ұ

3.N ү () . ғ .

#include <conio.h>

#include <stdio.h>

#include <stdio.h>

void main()

<

int a[100];

int n;

printf (enter;);

scanf(%i,&n);

for (int i=0;j=n-1 i<j; i++;j--)

< int r=a[i];

a[i]=a[j]

a[j]=r;

getch();

>

 

 

26-

1-. ө , қ ә ғ ә.

ө ү қ ң өң ө . : int a[4][3];

ғқ , ғ ө, 12 ұ.

ғ қ ә :

int a[4][3]={ {0,1,2},

{3,4,5},

{6,7,8},

{9,10,11}

};

ү қ қ :

int a[4][3]={0,1,2,3,4,5,6,7,8,9,10,11};

ү ң ғ қ, қғ 0- ң :

int a[4][3]={ {0},{3},{6},{9} };

ү қ , ғ ө.

int a[4][3]={ 0,3,6,9 };

ұ ң 3 ң қ , қғ 0 .

 

2-. құ

ұ. құғ . ң ғ ғқ ә қ . , ң қ қ қ ү . , (main, f1, f2) құ ә ң ү main() қ. қ өң, ң () . ұ ғ ққ ғ қ ә . ә /ғ ө ү қ. ұғ ұ, ү қ . Ә ; ң қ.

 

27-

1-. ң ө өң ә

өң ө өң қғ . өң қ қ ө қғ , :

ң қ өң .

ң ә ә ғ - өң .

ң қ өң

. қ ұ a4,6 . ө , ұғ P1 P2 ә ғ ң ң ә ң ө.

/* a[4][6] i. z=p1/|p2| , p1 p2 ң

ң ә i iiң өiii */

 

2-. ғ ң

- ғ ү , ө ң ұ:

1. қ ү ө, ғ ә қ .

2. ғң - ңғ қ ә қ.

3. ғ ү .

4. - ғ ә ң қ ү.

5. ә .

6. - ғ ә ққ ә ү қ.

қ ү ө ң ә қ ң қ ә қ , ө қ .ү , ң қ ғң қ ә қ . Қ қ ң ғ ң қ ә , ң ө ң . ұ қ ғ ә䳭, ә ү, ә ғң ғ қ қ.ң ғ, ң ғ -ә ү ө.

 

 

28-

1-. ң қ өң

 

өң ө өң қғ . өң қ қ ө қғ , :

ң қ өң .

ң ә ә ғ - өң

. ү ұ b5,5 . ң ң ғ ә ң ғ қ ө ң қ, ң ң .

:

L1 ң ғ (ө) қ ;

L2 ң ң ғ (ғ) қ ;

L= |L1-L2| ң .

#include <math.h>

#include <conio.h>

#include <stdio.h>

void line()

{printf("-------------------------\n");

return;}

main ()

{

static int b[5][5]={

{5,0,0,0,0},

{0,3,12,0,0},

{0,33,13,14,0},

{0,23,0,14,0},

{35,0,13,14,9},

};

int i,j;

int L1,L2,L;

clrscr();

printf("i :\n");

line();

for (i=0; i<5; i++)

{for (j=0; j<5; j ++)

printf(" %3i ", b[i][j]);

printf("\n");}

line();

L1 = L2 = 0;

for (i=0; i<5; i++)

for (j=0; j<5; j ++)

if (b[i][j]==0)

{if (i>j) L1 = L1+1;

if (i<j) L2 = L2 +1;

}

L= abs(L1 - L2);

printf(" L = %i ",L);

getch();

}

2-. , ұғ

ғ ү ұқ . ғ ү ұ. ң ә ғ. Ә ғ . ң құғ . қғ . ғ қ ү ұқ . - ү ә ғ ғ қ . Ә -ң өң қ , ( ң) . ө , ғ қ ғ ғ . , ө ү ұ, ө ( қ) ү ұ ә ә ә ү қ қ.

 

29-

1-. ң ң ә ғң ң ү () , қ, ө

 

өң ө өң қғ . өң қ қ ө қғ , :

ң қ өң .

ң ә ә ғ - өң .

 

2-. ә

- ү , ғ ңқ ө . ө ү:

1) ғ қ ;

2) ;

3) қғ .

қ ғ ө - қ, ө ә, ққ . , ғ қ өң ұ ң қ . , ғ ғ -ө ү, ә қ, ң ү ү ә, ғ қ -ә, ң қ ә, ү ө ә қ ә қ құ .

 

30-

1-. ң ә ғ қ ө ()

 

өң ө өң қғ . өң қ қ ө қғ , : ң қ өң , ң ә ә ғ - өң .

. ң ә ғ қ ә қv





:


: 2017-03-18; !; : 2775 |


:

:

! . .
==> ...

993 - | 818 -


© 2015-2024 lektsii.org - -

: 0.586 .