פורסם 2011 בינואר 1414 שנים שלום לכולםאני לומד הנדסאי תוכנה ויש לנו עבודת הגשה לעשות צייר בשפת borland cהתחלתי לכתוב ונתקעתי בפקודות,התרגיל הינו לעשות סוג של צייר שבצד יש קו פשוט מתחתיו עיגול מתחתיו מלבן מתחתיו מצולע מתחתיו עפרון שאפשר לרשום איתו וכפתור EXITובחלון למטה לעשות לחצנים עם 16 צבעים.להלן חלק מהתרגיל שעשיתי,#include<graphics.h>#include<stdio.h>#include<conio.h>#include<dos.h>int x=0,y=0,x1,x2,y1,y2,z=0,color=0;void cselect(){ if (x>0 && x<40) color=0; if (x>40 && x<80) color=1; if (x>80 && x<120) color=2; if (x>120 && x<160) color=3; if (x>160 && x<200) color=4; if (x>200 && x<240) color=5; if (x>240 && x<280) color=6; if (x>280 && x<320) color=7; if (x>320 && x<360) color=8; if (x>360 && x<400) color=9; if (x>400 && x<440) color=10; if (x>440 && x<480) color=11; if (x>480 && x<520) color=12; if (x>520 && x<560) color=13; if (x>560 && x<600) color=14; if (x>640 && x<640) color=15;}void drawall(){//draws templateint i,j;for (i=0,j=0;i !=640;i+=40,j++){setfillstyle(1,j);bar(i,450,i+40,480);}setcolor(5);for (i=0;i!=420;i+=60) rectangle(0,i,60,i+60);rectangle(0,420,60,449);line(10,50,50,10);circle(30,90,20);rectangle(15,140,45,160);//drawpoly(6,poly);}//initand show the mousevoid minit(){ union REGS regs,inreg,outreg; regs.x.ax = 0; int86(0x33, ®s, ®s); inreg.x.ax =0x1; int86(0x33,&inreg,&outreg); }void ginit(){int gd=DETECT,gm,errorcode;initgraph(&gd,&gm,"c:\\BORLANDC\\BGI");}void drawl(int x1,int y1,int x2,int y2){setcolor(color);line(x1,y1,x2,y2);}void a(){ union REGS regs; do { gotoxy(1,1); printf("%3d,%3d",x,y); //movement regs.x.ax=3; int86(0x33,®s,®s); if (regs.x.bx && z==0) { if (y>449) cselect(); z++; //printf("Left button pressed.\n"); x1=x; y1=y; } if (!regs.x.bx && z==1) { //printf("Left button released.\n"); z=0; x2=x; y2=y; drawl(x1,y1,x2,y2); } regs.x.ax=3; int86(0x33,®s,®s); x= regs.x.cx; y= regs.x.dx; } while (!kbhit()); }int main(){ ginit(); minit(); //mshow(); drawall(); a(); getch();}ופה נתקעתי לא יודע מה לעשות עוד,אם מישהו יכול להמשיך להשלים לי את התרגיל אני ישמח#include<graphics.h>#include<stdio.h>#include<conio.h>#include<dos.h>int x=0,y=0,x1,x2,y1,y2,z=0,color=0;void cselect(){ if (x>0 && x<40) color=0; if (x>40 && x<80) color=1; if (x>80 && x<120) color=2; if (x>120 && x<160) color=3; if (x>160 && x<200) color=4; if (x>200 && x<240) color=5; if (x>240 && x<280) color=6; if (x>280 && x<320) color=7; if (x>320 && x<360) color=8; if (x>360 && x<400) color=9; if (x>400 && x<440) color=10; if (x>440 && x<480) color=11; if (x>480 && x<520) color=12; if (x>520 && x<560) color=13; if (x>560 && x<600) color=14; if (x>640 && x<640) color=15;}void drawall(){//draws templateint i,j;for (i=0,j=0;i !=640;i+=40,j++){setfillstyle(1,j);bar(i,450,i+40,480);}setcolor(5);for (i=0;i!=420;i+=60) rectangle(0,i,60,i+60);rectangle(0,420,60,449);line(10,50,50,10);circle(30,90,20);rectangle(15,140,45,160);//drawpoly(6,poly);}//initand show the mousevoid minit(){ union REGS regs,inreg,outreg; regs.x.ax = 0; int86(0x33, ®s, ®s); inreg.x.ax =0x1; int86(0x33,&inreg,&outreg); }void ginit(){int gd=DETECT,gm,errorcode;initgraph(&gd,&gm,"c:\\BORLANDC\\BGI");}void drawl(int x1,int y1,int x2,int y2){setcolor(color);line(x1,y1,x2,y2);}void a(){ union REGS regs; do { gotoxy(1,1); printf("%3d,%3d",x,y); //movement regs.x.ax=3; int86(0x33,®s,®s); if (regs.x.bx && z==0) { if (y>449) cselect(); z++; //printf("Left button pressed.\n"); x1=x; y1=y; } if (!regs.x.bx && z==1) { //printf("Left button released.\n"); z=0; x2=x; y2=y; drawl(x1,y1,x2,y2); } regs.x.ax=3; int86(0x33,®s,®s); x= regs.x.cx; y= regs.x.dx; } while (!kbhit()); }int main(){ ginit(); minit(); //mshow(); drawall(); a(); getch();
פורסם 2011 בינואר 1414 שנים לחץ על "עריכה" כדי לערוך את ההודעה.סמן את הקוד.לחץ על כפתור "הכנס קוד" שלמעלה (ליד הכפתור של הציטוט, עם ציור של #).
פורסם 2011 בינואר 2214 שנים מחבר מה אפשר יותר למקד מאשר ששלחתי את כל התרגיל שעשיתי רק נשאר כמה פק ודות שאני לא מצליח לעשות,אם מישהו היה פותח את התרגיל ורואה מה שעשיתי זה לא היה מסובך להמשיך אני פשוט לא זוכר את הפקודות
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.