بيم الله الرحمن الرحيم
إخواني ذزي الخبرة في لغة السي وبالتحديد (graph) عندي واجب وقريب تسليمه الكود الذي سوف أضعه يعطي نتيجة
وهي كالتالي:
تخرج دائرة باللون الأزق وعندما تضغط بالزر الأيمن للماوس تخرج كرة في الجهة اليمنى بلون أخر وعندما تضغط باالزر الأيسر
للماوس تظهر كرة أخري بلون أخر في الجهة اليمنى وطبعاً تمسح الكرة السابقة .
المطلوب بالتحديد أن يتم إضافة كود (إضافات ) بحيت عندما نضغظ على أي مكان في الشاشة تظهر كرة وتمسح التي قبلها .
وإليكم الكود :
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<iostream.h>
#include<dos.h>
#include<stdio.h>
//void flag();
int s=1,l=0,l1=1,false=0,true=1,pres=5;
void mouse_fun()
{union REGS in_regs;
union REGS out_regs;
union REGS se_regs;
in_regs.x.ax=s;
int86(0x33,&in_regs,&out_regs);
//int86x(0x21
}
void information(int *a1,int *a2)
{
union REGS in_regs;
union REGS out_regs;
///*//
union REGS se_regs;
in_regs.x.ax=*a1;
in_regs.x.bx=*a2;
int86(0x33,&in_regs,&out_regs);
*a1=out_regs.x.ax;
*a2=out_regs.x.bx;
}
int flag(int button)
{
int m1,m2;
m1=pres;
if(button==l)
{m2=l;
information(&m1,&m2);
if(m2)
return(true);
}
if(button==l1)
{m2=l1;
information(&m1,&m2);
if(m2)
return(true);
}
return(false);
}
void main()
{
int driver=DETECT,mode;
initgraph(&driver,&mode,"c:\\tc\\bgi");
int maxx,maxy;
// int l=0,l1=1;
mouse_fun();
maxx=getmaxx()/2;
maxy=getmaxy()/2;
setcolor(BLUE);
circle(maxx,maxy,50);
while(!kbhit())
{
if(flag(l1))
{
setcolor(YELLOW);
clrscr();
circle(maxx,maxy,50);
}
if(flag(l))
{
setcolor(RED);
clrscr();
circle(200,200,50);
}
}
getch();
}
أرجوا المساعدة وشكراً