| | |
plzzzzzzzzzzz help me............
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
hey guys, i need some real bad help for my c++ project......i'm making an analog clock in C++ graphics.........n my clock works just fine, except for the fact that i haven't as yet added an hour hand, :rolleyes: and yeah..my minute hand runs almost as fast as my second hand.:lol:.....plzzzzzzzzzzzz get me outta this, i need ur help......
here's my program..........
p.s.-leave alone the initial few lines, they're just an intro, meant for my teacher..........
n yeah, guys, i'm in an indian school, in XI standard, so my project's supposed to be pretty easy........so plzzzzzzzz make corrections in my project while keeping it in my brain's reach.....all i ask is tht u guys keep it easy...........
this is my program.............
kanika
here's my program..........
p.s.-leave alone the initial few lines, they're just an intro, meant for my teacher..........
n yeah, guys, i'm in an indian school, in XI standard, so my project's supposed to be pretty easy........so plzzzzzzzz make corrections in my project while keeping it in my brain's reach.....all i ask is tht u guys keep it easy...........
this is my program.............
C++ Syntax (Toggle Plain Text)
#include<iostream.h> #include<graphics.h> #include<dos.h> #include<conio.h> void main() { int gd=DETECT,gm,i,j,x,a,b,c,d,e,f; initgraph(&gd,&gm," "); { setcolor(4); setbkcolor(0); settextstyle(4,0,6); for(a=0;a<=750;a=a+25) for(b=0;b<=7;b++) { { setcolor(b); sound(100); delay(50); outtextxy(a,a,"COMPUTER PROJECT"); } clearviewport(); } for(c=0;c<=350;c=c+5) for(d=0;d<=7;d++) { setcolor(d); sound(50); outtextxy(250,250,"made by kanika"); outtextxy(250,300,"and simran"); rectangle(260-c,400-c,200-c,250+c); } clearviewport(); { for(f=0;f<=700;f=f+3) for(e=0;e<=7;e++) { setcolor(e); circle(360,250,f); outtextxy(100,230,"AnAlOg ClOcK"); } } clearviewport(); nosound(); circle(290,250,200); outtextxy(260,40,"12"); outtextxy(180,65,"11"); outtextxy(120,135,"10"); outtextxy(100,210,"9"); outtextxy(120,280,"8"); outtextxy(180,350,"7"); outtextxy(260,390,"6"); outtextxy(360,350,"5"); outtextxy(440,280,"4"); outtextxy(460,210,"3"); outtextxy(440,135,"2"); outtextxy(360,65,"1"); for(j=360;j>=0;j=j-5) for(i=450;i>=0;i=i-5) { { setcolor(4); setbkcolor(0); delay(50); pieslice(290,250,i,i--,100); setfillstyle(0,0); floodfill(290,250,0); circle(290,250,100); { delay(300); pieslice(290,250,j,j--,50); } } } } } getch();
kanika
Last edited by stymiee; Feb 24th, 2007 at 11:58 am. Reason: add code tags
Since you're using non-standard headers, I think most people will have a hard time running your code. And without proper indentation, they'll have a hard time reading it.
To see if I'm understanding the code correctly, I'll repost part of it with comments:
The problem is that you'll draw the minute hand every time you draw the second hand. You need to move the innermost block into the outer for loop (after the inner loop), then possibly readjust your loop conditions. Pseudo-code:
That way the minute hand only gets updated when the second hand has gone all the way around. For the hour hand, do something similar with yet another loop encompassing these.
To see if I'm understanding the code correctly, I'll repost part of it with comments:
C++ Syntax (Toggle Plain Text)
// don't know what the loop conditions are for... for(j=360;j>=0;j=j-5) { for(i=450;i>=0;i=i-5) { { setcolor(4); setbkcolor(0); delay(50); // does this sleep for 50ms? pieslice(290,250,i,i--,100); // draw second hand setfillstyle(0,0); floodfill(290,250,0); circle(290,250,100); { delay(300); // sleep again? pieslice(290,250,j,j--,50); // draw minute hand } } } }
C++ Syntax (Toggle Plain Text)
for(/* ... */) { for( /* ... */ ) { /* whatever to draw second hand goes here */ } /* whatever to draw minute hand goes here */ }
plzzzzzzzzzzz read the forum rules, especially
thread titles & homework requests (you want us to finish it for you?)
Code Tags and Formatting C / C++ code (you want us to read your code?)
thread titles & homework requests (you want us to finish it for you?)
Code Tags and Formatting C / C++ code (you want us to read your code?)
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
hey thnx for tryin to help.............cant thnk u enuff
n here are the answers to ur queries......
// don't know what the loop conditions are for...(this one's for the pieslice function....scroll down n u'll c it rite after the commands for the clock's body.....this is solely to change the values so as to make the minute hand move)
n here are the answers to ur queries......
// don't know what the loop conditions are for...(this one's for the pieslice function....scroll down n u'll c it rite after the commands for the clock's body.....this is solely to change the values so as to make the minute hand move)
c Syntax (Toggle Plain Text)
for(j=360;j>=0;j=j-5) { for(i=450;i>=0;i=i-5) { { setcolor(4); setbkcolor(0); delay(50); // does this sleep for 50ms?(yeah......it does) pieslice(290,250,i,i--,100); // draw second hand setfillstyle(0,0); floodfill(290,250,0); circle(290,250,100); { delay(300); // sleep again?(this is to maintain a time gap between the second n minute hands) pieslice(290,250,j,j--,50); // draw minute hand } } } }
Last edited by Ancient Dragon; Feb 25th, 2007 at 7:43 am. Reason: add code tags
hey leave tht plzzzzzzzzzz n help me get outta this mess i've landed in..........u temme how to correct this program....a few corrections that i made are as follows.....
kanika
p.s.-will be real gratefull to u if you can help me further
c Syntax (Toggle Plain Text)
#include<iostream.h> #include<graphics.h> #include<dos.h> #include<conio.h> void main() { int gd=DETECT,gm,i,j,x,a,b,c,d,e,f; initgraph(&gd,&gm," "); { setcolor(4); setbkcolor(0); settextstyle(4,0,6); for(a=0;a<=750;a=a+25) for(b=0;b<=7;b++) { { setcolor(b); sound(100); delay(50); outtextxy(a,a,"COMPUTER PROJECT"); } clearviewport(); } for(c=0;c<=350;c=c+5) for(d=0;d<=7;d++) { setcolor(d); sound(50); outtextxy(250,250,"made by kanika"); outtextxy(250,300,"and simran"); rectangle(260-c,400-c,200-c,250+c); } clearviewport(); { for(f=0;f<=700;f=f+3) for(e=0;e<=7;e++) { setcolor(e); circle(360,250,f); outtextxy(100,230,"AnAlOg ClOcK"); } } clearviewport(); nosound(); circle(290,250,200); outtextxy(260,40,"12"); outtextxy(180,65,"11"); outtextxy(120,135,"10"); outtextxy(100,210,"9"); outtextxy(120,280,"8"); outtextxy(180,350,"7"); outtextxy(260,390,"6"); outtextxy(360,350,"5"); outtextxy(440,280,"4"); outtextxy(460,210,"3"); outtextxy(440,135,"2"); outtextxy(360,65,"1"); for(j=360;j>=0;j=j-5) for(i=450;i>=0;i=i-5) { { setcolor(4); setbkcolor(0); delay(100); pieslice(290,250,i,i--,100); circle(290,250,100); setfillstyle(0,0); floodfill(290,250,0); } delay(6000); pieslice(290,250,j,j--,50); circle(290,250,150); setfillstyle(0,0); floodfill(290,250,0); } } } getch();
kanika
p.s.-will be real gratefull to u if you can help me further
Last edited by Ancient Dragon; Feb 25th, 2007 at 7:48 am. Reason: add code tags
c Syntax (Toggle Plain Text)
#include<iostream.h> #include<graphics.h> #include<dos.h> #include<conio.h> void main() { int gd=DETECT,gm,i,j,x,a,b,c,d,e,f; initgraph(&gd,&gm," "); { setcolor(4); setbkcolor(0); settextstyle(4,0,6); for(a=0;a<=750;a=a+25) for(b=0;b<=7;b++) { { setcolor(b); sound(100); delay(50); outtextxy(a,a,"COMPUTER PROJECT"); } clearviewport(); } for(c=0;c<=350;c=c+5) for(d=0;d<=7;d++) { setcolor(d); sound(50); outtextxy(250,250,"made by kanika"); outtextxy(250,300,"and simran"); rectangle(260-c,400-c,200-c,250+c); } clearviewport(); { for(f=0;f<=700;f=f+3) for(e=0;e<=7;e++) { setcolor(e); circle(360,250,f); outtextxy(100,230,"AnAlOg ClOcK"); } } clearviewport(); nosound(); circle(290,250,200); outtextxy(260,40,"12"); outtextxy(180,65,"11"); outtextxy(120,135,"10"); outtextxy(100,210,"9"); outtextxy(120,280,"8"); outtextxy(180,350,"7"); outtextxy(260,390,"6"); outtextxy(360,350,"5"); outtextxy(440,280,"4"); outtextxy(460,210,"3"); outtextxy(440,135,"2"); outtextxy(360,65,"1"); for(j=360;j>=0;j=j-5) for(i=450;i>=0;i=i-5) { { setcolor(4); setbkcolor(0); delay(100); pieslice(290,250,i,i--,100); circle(290,250,100); setfillstyle(0,0); floodfill(290,250,0); } delay(6000); pieslice(290,250,j,j--,50); circle(290,250,150); setfillstyle(0,0); floodfill(290,250,0); } } } getch();
kanika
p.s.-will be real gratefull to u if you can help me further
Last edited by Ancient Dragon; Feb 25th, 2007 at 7:49 am. Reason: code tags
Indentation is just using tabs or spaces to mark where blocks start and end. Look at the difference (btw, there's some comments I added too):
Now, could you restate the prbblems you currently have? I can't run your program because of the headers you're using, but I'll try to help out again...
[edit:] Ok, I just noticed you didn't even put the code tags on your last post. Before I even consider helping you again, you need to learn to use them. It's really easy. When you post your code, you put [code] before it and [/code] after it. That will preserve the indentation when you copy your source and paste it in the post window. Using them is part of the rules of the forum, so you'd better start using them.
c Syntax (Toggle Plain Text)
#include<iostream.h> #include<graphics.h> #include<dos.h> #include<conio.h> void main() // should be int main() { int gd=DETECT,gm,i,j,x,a,b,c,d,e,f; initgraph(&gd,&gm," "); { // why start a block here? setcolor(4); setbkcolor(0); settextstyle(4,0,6); for(a=0;a<=750;a=a+25) for(b=0;b<=7;b++) { { // why create a block here? setcolor(b); sound(100); delay(50); outtextxy(a,a,"COMPUTER PROJECT"); } clearviewport(); } for(c=0;c<=350;c=c+5) for(d=0;d<=7;d++) { setcolor(d); sound(50); outtextxy(250,250,"made by kanika"); outtextxy(250,300,"and simran"); rectangle(260-c,400-c,200-c,250+c); } clearviewport(); { // why create a block here? for(f=0;f<=700;f=f+3) for(e=0;e<=7;e++) { setcolor(e); circle(360,250,f); outtextxy(100,230,"AnAlOg ClOcK"); } } clearviewport(); nosound(); circle(290,250,200); outtextxy(260,40,"12"); outtextxy(180,65,"11"); outtextxy(120,135,"10"); outtextxy(100,210,"9"); outtextxy(120,280,"8"); outtextxy(180,350,"7"); outtextxy(260,390,"6"); outtextxy(360,350,"5"); outtextxy(440,280,"4"); outtextxy(460,210,"3"); outtextxy(440,135,"2"); outtextxy(360,65,"1"); for(j=360;j>=0;j=j-5) for(i=450;i>=0;i=i-5) { { // why create a block here? setcolor(4); setbkcolor(0); delay(100); pieslice(290,250,i,i--,100); circle(290,250,100); setfillstyle(0,0); floodfill(290,250,0); } delay(6000); pieslice(290,250,j,j--,50); circle(290,250,150); setfillstyle(0,0); floodfill(290,250,0); } } } getch(); // this isn't even in main()
[edit:] Ok, I just noticed you didn't even put the code tags on your last post. Before I even consider helping you again, you need to learn to use them. It's really easy. When you post your code, you put [code] before it and [/code] after it. That will preserve the indentation when you copy your source and paste it in the post window. Using them is part of the rules of the forum, so you'd better start using them.
![]() |
Similar Threads
Other Threads in the C++ Forum
- Previous Thread: Access Reading Violation
- Next Thread: Libraries
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






