Page 4 of 6 FirstFirst 123456 LastLast
Results 46 to 60 of 88

Thread: C++ Help

  1. #46
    Prinny God Recognized Member Endless's Avatar
    Join Date
    Aug 2000
    Location
    Prinny Moon
    Posts
    2,641
    Contributions
    • Former Cid's Knight

    Default

    Well, duh. tw goes 1000, 999, 998 ..., 2, 1, 999, 998, 997..., 2, 1, 999, ... Why is tw=999 <b>inside</b> the while loop?

    And then there is Death

  2. #47
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    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 << ":" <<seconds << "\n";
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  3. #48
    Old school, like an old fool. Flying Mullet's Avatar
    Join Date
    Apr 2003
    Location
    Napping in a peach tree.
    Posts
    19,185
    Articles
    6
    Blog Entries
    7
    Contributions
    • Former Administrator
    • Former Cid's Knight
    • Former Senior Site Staff

    Default

    And don't forget to re-initialize "tw".

    Code:
            while (seconds > 0)
            {
                while (tw<1000)
                {
                   tw++;
                   cout << hours << ":" << minutes << ":" <<seconds << "\n";
                }
                seconds=seconds-1;
                tw = 0;
            }
    Figaro Castle

  4. #49
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    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.
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  5. #50
    Old school, like an old fool. Flying Mullet's Avatar
    Join Date
    Apr 2003
    Location
    Napping in a peach tree.
    Posts
    19,185
    Articles
    6
    Blog Entries
    7
    Contributions
    • Former Administrator
    • Former Cid's Knight
    • Former Senior Site Staff

    Default

    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.
    Figaro Castle

  6. #51
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    I had an infinite loop involving negative time when I first tried it on my own. I thought you'd find that humorous.
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  7. #52
    Old school, like an old fool. Flying Mullet's Avatar
    Join Date
    Apr 2003
    Location
    Napping in a peach tree.
    Posts
    19,185
    Articles
    6
    Blog Entries
    7
    Contributions
    • Former Administrator
    • Former Cid's Knight
    • Former Senior Site Staff

    Default

    You've discovered how to go back in time!
    Figaro Castle

  8. #53
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    Wanna borrow it? BACK TO 1982!
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  9. #54
    Old school, like an old fool. Flying Mullet's Avatar
    Join Date
    Apr 2003
    Location
    Napping in a peach tree.
    Posts
    19,185
    Articles
    6
    Blog Entries
    7
    Contributions
    • Former Administrator
    • Former Cid's Knight
    • Former Senior Site Staff

    Default

    Push it to the limit!
    Figaro Castle

  10. #55
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    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.
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  11. #56
    Golden Boy Mr. Wertz's Avatar
    Join Date
    Apr 2005
    Location
    Where ever I wanna live!
    Posts
    20

    Default

    Im finished with it too.
    Last edited by Mr. Wertz; 03-14-2006 at 05:06 PM.

  12. #57
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    PM me instead of spamming, kthxbai.
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  13. #58
    Golden Boy Mr. Wertz's Avatar
    Join Date
    Apr 2005
    Location
    Where ever I wanna live!
    Posts
    20

    Default

    how does this cube program look bbomber72011.

    Code:
    //Bryan Wertz II
    //March 8th, 2006
    //Intermediate C++, Terminal 1.
    //Cube Program
    
    #include <graphics.h> //Header file.
    #include <conio.h> //Header file.
    #include <iostream.h> //Header file.
    #include <fstream.h> //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.
      }

  14. #59
    Old-Ones Studios Cruise Control's Avatar
    Join Date
    Apr 2005
    Location
    Seattle, WA
    Posts
    3,799

    Default

    IT SUCKS!

    Nice job, it runs.
    Leave some shards under the belly
    Lay some grease inside my hand
    It's a sentimental jury
    And the makings of a good plan

  15. #60
    Golden Boy Mr. Wertz's Avatar
    Join Date
    Apr 2005
    Location
    Where ever I wanna live!
    Posts
    20

    Default

    it doesnt suck.

    and if it does, then it doesnt matter because I found it anyway. LAWLZ.
    Last edited by Mr. Wertz; 03-14-2006 at 05:16 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •