Well, duh. tw goes 1000, 999, 998 ..., 2, 1, 999, 998, 997..., 2, 1, 999, ... Why is tw=999 inside the while loop?
Printable View
Well, duh. tw goes 1000, 999, 998 ..., 2, 1, 999, 998, 997..., 2, 1, 999, ... Why is tw=999 inside the while loop?
TW is initialized to one. But all it does is print out the entered value 60 times.
;______________;
Code:while (hours >= 0)
while (tw<1000)
{
tw++;
cout << hours << ":" << minutes << ":" <
And don't forget to re-initialize "tw".
Code:while (seconds > 0)
{
while (tw<1000)
{
tw++;
cout << hours << ":" << minutes << ":" <}
seconds=seconds-1;
tw = 0;
}
Thanks to you brilliant gents *checks Endless's profile*, I have it counting properly, and all I need to do is tweak the counter till it's in tune with a clock.
After you tweak it for the computer that you are programming on, you should try running the program on a computer that is either slower or faster than it. This will show you how much variance the computer's processing power will have on the time and if it will be noticable if someone else runs it on a different computer.
I had an infinite loop involving negative time when I first tried it on my own. I thought you'd find that humorous.
You've discovered how to go back in time! :eek:
Wanna borrow it? BACK TO 1982!
Push it to the limit!
Done. I'm off only by .5 of a second every minute, well within the range of 15% error. XD. I'm so uber. I really appreciate all your help.
Im finished with it too.
PM me instead of spamming, kthxbai.
how does this cube program look bbomber72011.
Code:
//Bryan Wertz II
//March 8th, 2006
//Intermediate C++, Terminal 1.
//Cube Program
#include//Header file.
#include//Header file.
#include//Header file.
#include//Header file.
void Cube_Printer() //function that prints a cube on the screen.
{
int graphdriver=DETECT,graphmode; //Goes into Graphics mode.
initgraph(&graphdriver,&graphmode,"c:..\\bgi");
moveto(120,130);
lineto(150,110);
lineto(210,110);
lineto(180,130);
lineto(120,130);
moveto(120,170);
lineto(180,170);
lineto(210,150);
lineto(210,110);
moveto(120,170);
lineto(120,130);
moveto(180,170);
lineto(180,130);
moveto(210,150);
lineto(150,150);
lineto(120,170);
moveto(150,150);
lineto(150,110);
setbkcolor(1);
setlinestyle(0,0,3);
setcolor(3);
rectangle(120,130,180,170);
moveto(120,130);
lineto(150,110);
lineto(210,110);
lineto(180,130);
moveto(210,110);
lineto(210,150);
lineto(180,170);
setlinestyle(1,0,3);
setcolor(3);
moveto(150,110);
lineto(150,150);
lineto(120,170);
moveto(150,150);
lineto(210,150);
moveto(300,300);
outtext("Press any key to end.");
getch();
closegraph(); //closes graph.
}
int main()
{
cout << "This is going to print a cube onto the screen.\n\n\n";
cout << " Press any key to continue!";
getch();
Cube_Printer(); //call to Cube_Printer.
return 0; //end of program.
}
IT SUCKS!
Nice job, it runs.
it doesnt suck.
and if it does, then it doesnt matter because I found it anyway. LAWLZ.