Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 337

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 339

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 341

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 343
Cant find problem argh

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Senior Member
    Join Date
    May 2008
    Posts
    122

    Cant find problem argh

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    char ch;
    int seconds;
    int minutes;
    int main(void)
    {
    printf("Enter M to count down from minutes or S to countdown from seconds ");
    scanf("%c",ch);
    if("ch==M"){
    printf("Enter the amount of minutes: ");
    scanf("%d",&seconds);
    for(minutes=seconds*60; minutes>-1; minutes--)
    if(minutes==0) printf("Count Down Complete \a \n");
    }
    else{
    printf("Enter the amount of seconds: ");
    scanf("%d",&seconds);
    for(seconds = seconds; seconds>-1; seconds--)
    if(seconds==0) printf("Count Down Complete \a \n");
    }
    system("pause");
    return 0;
     
    }
    Does anyone see problem? IF SO I WILL LOVE YOU HAHAHAHA
    I poopseded my pants

  2. #2
    Veteran Member |MuRDeR|'s Avatar
    Join Date
    Aug 2007
    Posts
    1,072

    Re: Cant find problem argh

    I have to strain my eyes just to read your writing let alone find out whats wrong with it.
    1st generation = Vacuum tubes 1946 - 1955
    2nd generation = Transistors 1956 - 1963
    3rd generation = Integrated Circuits 1964 - 1970
    4th generation = Microprocessors 1971 onwards
    5th generation = Quantum computers? Nanotechnology? Biological computers?

  3. #3
    Coders muppetalert's Avatar
    Join Date
    Nov 2007
    Location
    Manchester, UK
    Posts
    1,005

    Re: Cant find problem argh

    Same, jesus christ! Whatever happened to typing normally without having to use stupid colours

    Quote Originally Posted by sloppyjoe View Post
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    char ch;
    int seconds;
    int minutes;
    int main(void)
    {
      printf("Enter M to count down from minutes or S to countdown from seconds ");
      scanf("%c",ch);
      if("ch==M"){
        printf("Enter the amount of minutes: ");
        scanf("%d",&seconds);
        for(minutes=seconds*60; minutes>-1; minutes--)
          if(minutes==0) printf("Count Down Complete \a \n");
      }
      else{
        printf("Enter the amount of seconds: ");
        scanf("%d",&seconds);
        for(seconds = seconds; seconds>-1; seconds--)
          if(seconds==0) printf("Count Down Complete \a \n");
      }
      system("pause");
      return 0;
    }
    Does anyone see problem? IF SO I WILL LOVE YOU HAHAHAHA
    Now if you post your issue maybe we could help.. Apart from your dodgy if statement that probably doesn't do what you want (since it always evaluates to true) then I don't see anything else (Because I haven't read anything else).
    whiteLight: ET, whiteLight: Quake Live (Formerly QLHook) and many other game hacks at http://whitelight.me.uk/

  4. #4
    Site Admin xHalt's Avatar
    Join Date
    May 2006
    Location
    Belgium
    Posts
    8,202

    Re: Cant find problem argh

    Code:
    scanf("%c",ch);
    should be
    Code:
    scanf("%c",&ch);
    Otherwise, you'll end up with the 2 questions printed right after eachother.

    Code:
    if("ch==M"){
    shouldn't it be
    Code:
    if(ch=='M'){
    ? Or are both possible?

    You ask for the amount of minutes, yet you assign it to the variable seconds?
    Code:
    printf("Enter the amount of minutes: ");
        scanf("%d",&seconds);
    Btw: Your countdown of seconds/minutes won't decrease each second/minute. Those for-loops will just execute as fast as your CPU allows it. You'll end up with the complete countdown list in a blink of an eye. If you want the countdown to be realistic, include a simple wait method of some kind.

  5. #5
    Semi-Coder t00ny's Avatar
    Join Date
    Jan 2008
    Posts
    361

    Re: Cant find problem argh

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    char ch;
    int seconds;
    int minutes;
    int main(void)
    {
      printf("Enter M to count down from minutes or S to countdown from seconds ");
      scanf("%c",&ch);
    
      if(ch=='M')
      {
            printf("Enter the amount of minutes: ");
            scanf("%d",&seconds);
            for(minutes=seconds*60; minutes>-1; minutes--)
        {
            Sleep(60000); //1 minute in milliseconds
                  if(minutes==0) printf("Count Down Complete \a \n");
        }
      }
      else
      {
            printf("Enter the amount of seconds: ");
            scanf("%d",&seconds);
            for(seconds=; seconds>-1; seconds--)
        {
            Sleep(1000); //1 second in milliseconds
                  if(seconds==0) printf("Count Down Complete \a \n");
        }
      }
    
      system("pause");
      return 0;
    }
    Use Sleep to make a wait time.
    Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest. - I.A

  6. #6
    Senior Member
    Join Date
    May 2008
    Posts
    122

    Re: Cant find problem argh

    Quote Originally Posted by xHalt View Post
    Code:
    scanf("%c",ch);
    should be
    Code:
    scanf("%c",&ch);
    Otherwise, you'll end up with the 2 questions printed right after eachother.

    Code:
    if("ch==M"){
    shouldn't it be
    Code:
    if(ch=='M'){
    ? Or are both possible?

    You ask for the amount of minutes, yet you assign it to the variable seconds?
    Code:
    printf("Enter the amount of minutes: ");
        scanf("%d",&seconds);
    Btw: Your countdown of seconds/minutes won't decrease each second/minute. Those for-loops will just execute as fast as your CPU allows it. You'll end up with the complete countdown list in a blink of an eye. If you want the countdown to be realistic, include a simple wait method of some kind.
    tyvm and also to you toony i am not sure on how to fix colors problem i apologize this is to very help me much ty
    I poopseded my pants

  7. #7
    Senior Member
    Join Date
    May 2007
    Posts
    104

    Re: Cant find problem argh

    Here is my code. It worked for me very well.
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    
    char ch;
    int seconds;
    int minutes;
    
    int main(void)
    {
      printf("Enter M to count down from minutes or S to countdown from seconds ");
        scanf("%c", &ch);
    
        if(ch=='M') {
            printf("Enter the amount of minutes: ");
            scanf("%d",&minutes);
            for(minutes=seconds*60; minutes>-1; minutes--) {
                Sleep(60000); //1 minute in milliseconds
                printf("%d\n", minutes);
                if(minutes==0) printf("Count Down Complete! \a \n");
            }
        }
        else if(ch == 'S') {
            printf("Enter the amount of seconds: ");
            scanf("%d",&seconds);
            for(seconds = seconds; seconds>-1; seconds--) {
                Sleep(1000); //1 second in milliseconds
                printf("%d\n", seconds);
                if(seconds==0) printf("Count Down Complete! \a \n");
            }
        }
        else {
            printf("\nPlease try it again!\n");
            main();
        }
    
      system("PAUSE");
      return 0;
    }

  8. #8
    VIP sir3n's Avatar
    Join Date
    Jul 2006
    Location
    england
    Posts
    1,825

    Re: Cant find problem argh

    Quote Originally Posted by SiLenCe View Post
    Here is my code. It worked for me very well.
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    
    char ch;
    int seconds;
    int minutes;
    
    int main(void)
    {
      printf("Enter M to count down from minutes or S to countdown from seconds ");
        scanf("%c", &ch);
    
        if(ch=='M') {
            printf("Enter the amount of minutes: ");
            scanf("%d",&minutes);
            for(minutes=seconds*60; minutes>-1; minutes--) {
                Sleep(60000); //1 minute in milliseconds
                printf("%d\n", minutes);
                if(minutes==0) printf("Count Down Complete! \a \n");
            }
        }
        else if(ch == 'S') {
            printf("Enter the amount of seconds: ");
            scanf("%d",&seconds);
            for(seconds = seconds; seconds>-1; seconds--) {
                Sleep(1000); //1 second in milliseconds
                printf("%d\n", seconds);
                if(seconds==0) printf("Count Down Complete! \a \n");
            }
        }
        else {
            printf("\nPlease try it again!\n");
            main();
        }
    
      system("PAUSE");
      return 0;
    }
    dont you mean heres t00ny's code, it worked very well?

  9. #9
    Senior Member
    Join Date
    May 2008
    Posts
    122

    Re: Cant find problem argh

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    char ch;
    int seconds;
    int minutes;
    int error(void);
    int main(void)
    {
      printf("Enter m to count down from minutes or s to countdown from seconds\n");
        scanf("%c", &ch);
        if(ch=='m') {
            printf("Enter the amount of minutes:\n");
            scanf("%d",&minutes);
            for(minutes = minutes-1; minutes>-1; minutes--) {
                Sleep(60000); //1 minute in milliseconds
                printf("%d\n", minutes);
                if(minutes==0) printf("Count Down Complete! \a \n");
            }
        }
        else if(ch=='s') {
            printf("Enter the amount of seconds:\n");
            scanf("%d",&seconds);
            for(seconds = seconds-1; seconds>-1; seconds--) {
                Sleep(1000); //1 second in milliseconds
                printf("%d\n", seconds);
                if(seconds==0) printf("Count Down Complete! \a \n");
            }
        }
        else {
             error();
             }
        
      
      system("pause");
      return 0;
    }
    int error(void)
    {
        printf("Error! press t to try again or x to exit\n\a");
        scanf("%c", &ch);
        if(ch=='x') {
                     printf("terminating program\n");
                     return 0;
                     }
        else if(ch=='t') main();
        else {
             error();
             }
    }
    thanks guys this is along with your fixes plus an error system that i believe works a tad better and so that when you choose to count down from 8 minutes it dosnt do 9 It works perfect now thank you guys

    *
    sorry for double post but now that dosnt work the error function the ending process works find but the restart process does not
    I poopseded my pants

  10. #10
    Senior Member
    Join Date
    May 2007
    Posts
    104

    Re: Cant find problem argh

    Quote Originally Posted by Sir3n View Post
    dont you mean heres t00ny's code, it worked very well?
    Well I took tooney code but it's also nearly the same then sloppyjoe's code. But I added some thinks like:
    Code:
     else {
            printf("\nPlease try it again!\n");
            main();
        }
    and something else so I wrote that because I thought that it is my version of the code. If you compare them they are not the same so be cool...
    And at least he get father with
    Code:
     else {
            printf("\nPlease try it again!\n");
            main();
        }

    * see error()

Page 1 of 2 12 LastLast

Similar Threads

  1. help!can find cfg!
    By R4mer2007 in forum Crushr Flex Scripts
    Replies: 5
    Last Post: June 18th, 2009, 20:07
  2. argh
    By foozle in forum OpenGL
    Replies: 5
    Last Post: September 5th, 2008, 02:43
  3. Find X
    By ntKid in forum Comedy
    Replies: 16
    Last Post: June 24th, 2008, 18:16
  4. Replies: 2
    Last Post: August 28th, 2007, 12:59
  5. Where to find?
    By EfedrinE in forum Non-Gaming Related
    Replies: 2
    Last Post: June 2nd, 2007, 10:04

Bookmarks

Posting Permissions

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