Новичок
Профиль
Группа: Участник
Сообщений: 1
Регистрация: 2.6.2013
Репутация: нет Всего: нет
|
| Код | #include<conio.h> #include<dos.h> #include<graphics.h> #include<iostream.h> #include<stdlib.h> class ind { ind *next; int g,t,f,c,x,y;//t-vremya ost,i-vremya sozd,f-vremya rabotu int tx,fx; char s[10],r[10],p[10],z[10],v[10]; struct time i; public: ind(ind *nx) { f=0; cout<<"V kakom meste razmestit indikator, vvedite koordinatu x,y"; cin>>x>>y; cout<<"vvedite vremya deystvia indikatora"; cin>>t;//Вот это t нужно найти для объектов. tx=t; cout<<"chto vivodit? 1-vremya ost,2-vremya sozd,3-vremya rabotu\n"; cin>>c; next=nx; gettime(&i); } ind* getnext(){return next;} void vremya() { switch(c) { case 1:{itoa(t,s,10);t=t-1;outtextxy(x,y,s);if(t==0)t=tx;break;} case 2: { itoa(i.ti_hour,r,10); itoa(i.ti_min,z,10); itoa(i.ti_sec,v,10); outtextxy(x,y,r); outtextxy(x+20,y,z); outtextxy(x+40,y,v); break; } case 3:{itoa(f,p,10);f++;outtextxy(x,y,p);if(f==t)f=0;break;} default:cout<<"Oshibka,ne vernaya klavisha"; } } }; void main() { ind *head=NULL; int n,i,j,GD=0,GM; char q; //n=0; do { cout<<"Nagmite klavishu 1,chtoby dobavit odin indikator,ESC-chtobu zakoncit sodanie"; q=getch(); switch(q) { case'1':cout<<"Ukajite indikator:"; //n++; head=new ind(head);break; } }while(q!=27); initgraph(&GD,&GM,""); struct time tm1,tm2; gettime(&tm1); for(;;) { ind *temp=head; do { gettime(&tm2); if(kbhit()) if (getch()==8) { closegraph(); while(head) { temp=head->getnext(); delete head; head=temp; }return; } }while(tm1.ti_sec==tm2.ti_sec); tm1=tm2; temp=head; while(temp) { cleardevice(); temp->vremya(); temp=temp->getnext(); } } }
|
Нужно найти максимальное t и выделить его красным цветом.
|