Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Ba_1179_ylau_esepter_69_-_zhauaptar.docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
93.41 Кб
Скачать

Void main()

{

int a[3][3];

int i,j; clrscr(); randomize();

printf("MASSIV==> ");

for(i=0;i<3;i++) {printf("\n");

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

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

printf("%d\t",a[i][j]); }}

int max=a[0][0];

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

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

if((i==j) && (a[i][j]>max)) {max=a[i][j];}

printf("\n\nmax=%i",max);

getch(); }

  1. Бүтін сандардан тұратын А(3,3) жиымы берілген. Сол жиымдағы бас диагональ элементтері қосындысын табу керек.

#include<stdlib.h>

#include<conio.h>

#include<stdio.h>

Void main()

{

int a[3][3];

int i,j; clrscr(); randomize();

printf("MASSIV==> ");

for(i=0;i<3;i++) {printf("\n");

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

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

printf("%d\t",a[i][j]); }}

int m=0;

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

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

if(i==j) {m=m+a[i][j]; }

printf("\n\nkosyndy=%i",m);

getch(); }

  1. Бүтін сандардан тұратын А(3,3) жиымы берілген. Сол жиымдағы бас диагональ элементтері ішіндегі минимумын табу керек.

#include<stdlib.h>

#include<conio.h>

#include<stdio.h>

Void main()

{

int a[3][3];

int i,j; clrscr(); randomize();

printf("MASSIV==> ");

for(i=0;i<3;i++) {printf("\n");

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

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

printf("%d\t",a[i][j]); }}

int min=a[0][0];

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

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

if((i==j) && (a[i][j]<min)) {min=a[i][j];}

printf("\n\nmin=%i",min);

getch(); }

  1. Бүтін сандардан тұратын А(3,3) жиымы берілген. Сол жиымдағы бас диагональ элементтерінің көбейтіндісін табу керек.

#include<stdlib.h>

#include<conio.h>

#include<stdio.h>

Void main()

{

int a[3][3];

int i,j; clrscr(); randomize();

printf("MASSIV==> ");

for(i=0;i<3;i++) {printf("\n");

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

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

printf("%d\t",a[i][j]); }}

int m=1;

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

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

if(i==j) {m*=a[i][j]; }

printf("\n\nkobeityndy=%i",m);

getch(); }

  1. Берілген сөз тіркесінің ішіндегі «а» әрпін «о» әрпіне алмастыратын программа құру

#include <iostream.h>

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80]; clrscr();

int i,l;

puts("soz engiz:");

gets(str);

l=strlen(str);

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

if(str[i]=='a') { str[i]='o'; }

printf("%c",str[i]);}

getch();}

  1. Берілген сөз тіркесіндегі бірінші сөзді өшіру программасын құру

#include <iostream.h>

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80];

clrscr();

int i,l,k,c;

puts(“soz tirkesin engiz”);

gets(str);

l=strlen(str)

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

if(str[i]==’ ‘) {k=i; break;}

}

for(i=k;i<l;i++){

putchar(str[i]);}

getch();

}

  1. Берілген сөз тіркесінің екінші сөзін экранға шығаратын программа құру

#include <iostream.h>

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80];

clrscr();

int i,l,k,c;

puts(“soz tirkesin engiz”);

gets(str);

l=strlen(str)

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

if(str[i]==’ ‘) {k=i; break;}

}

for(i=k;;i++){

if(str[i]==’ ‘) {c=i; break;}

}

for(i=k;i<=c;i++){

putchar(str[i]);}

getch();}

  1. Берілген сөз тіркесінің соңғы сөзін экранға шығаратын программа құру

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80];

clrscr();

int i,l,k,c;

puts(“soz tirkesin engiz”);

gets(str);

l=strlen(str)

for(i=l;;i--){

if(str[i]==’ ‘) {k=i; break;}}

for(i=k;i<l;i++){

putchar(str[i]);}

getch();}

  1. Берілген сөз тіркесін кері бағытта экранға шығаратын программа құру

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80];

clrscr();

int i,l,k,c;

puts(“soz tirkesin engiz”);

gets(str);

l=strlen(str)

for(i=l;i>=0;i--){

putchar(str[i]);}

getch();}

  1. Берілген сөз тіркесінің ішінде неше сөз бар екенін анықтайтын программа құру

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80];

clrscr();

int i,l,k=0,c;

puts(“soz tirkesin engiz”);

gets(str);

l=strlen(str);

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

if(str[i]==' ') k++;}

printf(“%i”,k+1);

getch();

}

  1. Берілген сөз тіркесінің ішінде неше сөз бар екенін анықтайтын программа құру

#include <string.h>

#include<conio.h>

#include<stdio.h>

main()

{

char str[80];

clrscr();

int i,l,k=0,c;

puts(“soz tirkesin engiz”);

gets(str);

l=strlen(str);

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

if(str[i]==' ') k++;}

printf(“%i”,k+1);

getch();}

  1. f:\file1.txt файлын оқып, ондағы сөздерді экранға шығару

#include<conio.h>

#include<stdio.h>

#include<iostream.h>

main()

{ char a[100];

char fname[]="D:\\sundet.txt"; clrscr();

FILE*fp;

fp=fopen(fname,"r");

fp=fopen("fp","rt");

if((fp=fopen(fname,"rt"))==NULL)

{printf("\n Fail awuda kate boldy!");

getch(); return(0);}

puts("Faildagy sozder:");

while(!feof(fp))

{ fscanf(fp,"%s",&a);

printf("%s ",a); }

fclose(fp);

getch();

}

  1. G: дискісінде number.txt файлын ашып, соған 5 бүтін сан жазу

#include<conio.h>

#include<stdio.h>

#include<math.h>

main()

{ int a[100];

char fname[]="D:\\number.txt"; clrscr();

FILE*fp;

fp=fopen(fname,"w"); printf("\nENTER arkyly \n");

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

printf("\n%i-wy sandy engyz: ",i+1);

scanf("%d",&a[i]);

fprintf(fp,"%d ",a[i]); } printf("\n");

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

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

printf("sandary 'number.txt' failyna jazyldy!");

fclose(fp);

getch();}

  1. Экранға 2 параллелепипед салупрограммасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setbkcolor(BLACK); setfillstyle(SOLID_FILL,GREEN);

bar3d(10,10,100,150,50,1);

bar3d(120,10,220,150,50,1);

getch();

closegraph();

return 0;}

  1. Экранға іші боялған 2 шеңбер, 2 эллипс салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setbkcolor(BLACK); setfillstyle(SOLID_FILL,GREEN);

circle(100,100,20); circle(160,100,20);

fillellipse(100,160,30,20); fillellipse(180,160,30,20);

getch();

closegraph();

return 0;}

  1. Экранға 7 боялған сақина бейнесін салу

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

int x,y;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setfillstyle(1,1); fillellipse(200,200,30,30);

setfillstyle(1,2); fillellipse(200,200,40,40);

setfillstyle(1,3); fillellipse(200,200,50,50);

setfillstyle(1,4); fillellipse(200,200,60,60);

setfillstyle(1,5); fillellipse(200,200,70,70);

setfillstyle(1,6); fillellipse(200,200,80,80);

setfillstyle(1,7); fillellipse(200,200,90,90);

getch();

closegraph();

return 0;}

  1. Экранға нүктелер арқылы үшбұрыш салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setbkcolor(BLACK); setfillstyle(SOLID_FILL,GREEN);

for(int x=20;x<200;x++) putpixel(x,100,BLUE);

for(int y=100;y<=280;y++) putpixel(200,y,RED);

line(20,100,200,280);

getch();

closegraph(); return 0;}

  1. Экранға сызықтар арқылы үшбұрыш салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setbkcolor(BLACK); setfillstyle(SOLID_FILL,GREEN);

line(10,10,110,10); line(110,10,110,90); line(110,90,10,10);

getch();

closegraph();

return 0;}

  1. Экранға түстері әртүрлі параллель алты сызық салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"C:\\TC\\bgi");

setbkcolor(BLACK); setcolor(1);

line(10,10,110,10); setcolor(2);

line(10,20,110,20); setcolor(3);

line(10,30,110,30); setcolor(4);

line(10,40,110,40); setcolor(5);

line(10,50,110,50); setcolor(6);

line(10,60,110,60);

getch();

closegraph();

return 0;}

  1. Экранға алты бұрыш салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setcolor(1);

circle(200,200,50);

setfillstyle(1,2);

bar(150,150,250,250);

getch();

closegraph(); return 0;}

  1. Экранға түстері әртүрлі параллель алты сызық салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setbkcolor(BLACK); setcolor(1);

line(10,10,110,10); setcolor(2);

line(10,20,110,20); setcolor(3);

line(10,30,110,30); setcolor(4);

line(10,40,110,40); setcolor(5);

line(10,50,110,50); setcolor(6);

line(10,60,110,60);

getch();

closegraph();

return 0;}

  1. Экранға шеңбер ішінде жасыл квадрат салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setcolor(1);

circle(200,200,50);

setfillstyle(1,2);

bar(150,150,250,250);

getch();

closegraph();

return 0;}

  1. Экранға түрлі түсті 2 эллипс салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setbkcolor(BLACK); setfillstyle(SOLID_FILL,GREEN);

fillellipse(100,160,30,20); fillellipse(180,160,30,20);

getch();

closegraph();

return 0;}

  1. Экранға графикалық режимде вертикаль мәтін шығару (фамилияңыз мен атыңыз)

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

int x,y;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setcolor(5);

settextstyle(4,1,7); outtextxy(200,400,"Kuralov Sundet!");

getch();

closegraph();

return 0;}

  1. Экранға графикалық режимде горизонталь мәтін шығару (фамилияңыз мен атыңыз)

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

int x,y;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setcolor(5);

settextstyle(4,0,7); outtextxy(200,400,"Kuralov Sundet!");

getch();

closegraph();

return 0;}

  1. Экранға түрлі түсті концентрлі 6 шеңбер салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd = DETECT, gm;

int x,y;

initgraph(&gd, &gm,"D:\\TC\\bgi");

setfillstyle(1,1); fillellipse(200,200,30,30);

setfillstyle(1,2); fillellipse(200,200,40,40);

setfillstyle(1,3); fillellipse(200,200,50,50);

setfillstyle(1,4); fillellipse(200,200,60,60);

setfillstyle(1,5); fillellipse(200,200,70,70);

setfillstyle(1,6); fillellipse(200,200,80,80);

getch();

closegraph();

return 0;}

  1. Экранға әр түрлі 5 штрихтау сызықтарын салу программасын құру

#include <graphics.h>

#include <stdlib.h>

#include <conio.h>

main() {

int gd=DETECT,gm;

initgraph(&gd,&gm,"C:\\TC\\bgi");

setlinestyle(0,0,1); line(10,20,110,20);

setlinestyle(1,0,1); line(10,30,110,30);

setlinestyle(2,0,1); line(10,40,110,40);

setlinestyle(3,0,1); line(10,50,110,50);

setlinestyle(3,0,3); line(10,60,110,60);

getch();

closegraph();

return 0;

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]