I need a working counter.

This is a discussion on I need a working counter. within the C++ Programming forums, part of the General Programming Boards category; Can anyone show me the code for a working counter, what I want to happen is in this code: A: ...

  1. #1
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100

    I need a working counter.

    Can anyone show me the code for a working counter, what I want to happen is in this code:

    A:
    X=X+1;
    if (X==10000000)
    goto end;
    goto A

    but every time i run it, it opens up the window and then closes it instantly, I want it to open up for at least 5 seconds though...
    Please help.
    Signature is optional, I didnt opt for one.

  2. #2
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    If you wanted to, instead of:

    X = X + 1;

    do this:

    X = X +.1; //or X+=.1 does the same thing. Also, .1 might be too little, try .5 even.

    If you do this, then you'll need to declare X as:
    double X;
    or
    long double X;
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  3. #3
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100
    it didnt work, i even tried this:

    A:
    X=X+.00000001;
    if (X=1000000000)
    goto end;
    goto A;
    Signature is optional, I didnt opt for one.

  4. #4
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    You need to use the double equals sign in the if statement!

    if (X==100000000) {
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  5. #5
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100
    GRRRRRRRRRRRRRRRR


    *Hits himself for makeing a SUPER newby mistake*

    I deserved that for wasting ur time......

    Sorry, and I am much abliged that you could help me Thanks a lot!
    Signature is optional, I didnt opt for one.

  6. #6
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    no problem
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Counter Errors for otherwise working program???
    By jereland in forum C Programming
    Replies: 7
    Last Post: 03-22-2004, 07:37 PM
  2. Counter Heap Sort
    By Achillles in forum C++ Programming
    Replies: 1
    Last Post: 10-09-2002, 12:17 PM
  3. formulas & edit boxes, c++ on MSVC++ 5
    By TravelByMail in forum Windows Programming
    Replies: 1
    Last Post: 03-08-2002, 11:45 PM
  4. how to obtain first character of every other word
    By archie in forum C++ Programming
    Replies: 8
    Last Post: 02-18-2002, 12:58 PM
  5. can you help me please?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 01-12-2002, 08:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21