problem displaying the next fuction

This is a discussion on problem displaying the next fuction within the C Programming forums, part of the General Programming Boards category; dealornodeal(); doesnt display after the main(); Code: #include <stdio.h> #include <conio.h> #include <graphics.h> #include <stdlib.h> #include <dos.h> void dealornodeal(){ int ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    19

    problem displaying the next fuction

    dealornodeal(); doesnt display after the main();

    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <graphics.h>
    #include <stdlib.h>
    #include <dos.h>
    
    void dealornodeal(){
        int gd=DETECT,gm;
        initgraph(&gd,&gm,"");
    
        setfillstyle(1,7);
        bar(32,102,608,188);
        setfillstyle(1,14);
        bar(40,110,275,180);
        setfillstyle(1,14);
        bar(310,110,600,180);
        setfillstyle(1,8);
        bar(320,120,590,170);
        setcolor(8);settextstyle(0,0,7);
        outtextxy(50,122,"DEAL");
        setcolor(14);settextstyle(0,0,5);
        outtextxy(327,128,"NO");
        setcolor(14);settextstyle(0,0,5);
        outtextxy(426,128,"DEAL");
        setcolor(14);settextstyle(0,0,3);
        outtextxy(282,120,"O");
        setcolor(14);settextstyle(0,0,3);
        outtextxy(282,150,"R");
    
        setfillstyle(1,11);
        bar(185,300,295,335);
        setcolor(11);
        rectangle(182,297,298,338);
        setcolor(8);settextstyle(1,0,4);
        outtextxy(196,299,"[S]tart");
    
        setfillstyle(1,12);
        bar(325,300,435,335);
        setcolor(12);
        rectangle(322,297,438,338);
        setcolor(15);settextstyle(1,0,4);
        outtextxy(332,299,"[R]ules");
    
        getch();
        closegraph();
    }
    
    void main(){
        int s,x,x1=320,y1=240,x2=320,y2=240;
        int gd=DETECT,gm;
        initgraph(&gd,&gm,"");
        srand(time(NULL));
        for(;;x1--,x2++,y1++,y2--){
        setcolor(15);
        rectangle(x1,y1,x2,y2);
        delay(2000);
        if(x1==0)
        break;
        }
        setfillstyle(1,8);bar(10,10,630,470);
        setcolor(LIGHTRED);settextstyle(3,0,8);
        outtextxy(190,100,"ALPAKAN");
        setcolor(LIGHTBLUE);settextstyle(1,0,10);
        outtextxy(120,75,"S");
        setcolor(YELLOW);settextstyle(2,0,6);
        outtextxy(468,175,"GROUP");
        setcolor(WHITE);settextstyle(2,0,7);
        outtextxy(80,240,"CASE STUDY - Data Structures and Algorithm");
        setcolor(LIGHTCYAN);settextstyle(0,0,1);
        outtextxy(250,315,"Lli¤o Del Rosario");
        outtextxy(250,330,"Kimber Lloyd Loza");
        outtextxy(250,345,"Enjelmar Sumang");
        outtextxy(250,360,"Edison Tua¤o");
        for(x=1;;x++){
        setcolor(LIGHTGREEN);settextstyle(2,0,6);
        outtextxy(185,420,"<Press Any Key to Continue>");
        delay(100000000000);
        setcolor(BLACK);settextstyle(2,0,6);
        outtextxy(185,420,"<Press Any Key to Continue>");
        delay(100000000000);
        if(kbhit())
        break;
        }
        for(s=1;s<=4;s++){
        sound(5000-1000*s);
        delay(10000000);
        }
        nosound();
        closegraph();
        return dealornodeal();
    }

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Code:
        delay(100000000000);
    I'm pretty sure that overflows... And that is probably lucky, since 100000000/86400 is 1157 days, and I doubt that anyone would wait for 3 years to see the colour change on the text "press any key to continue".

    I expect this
    Code:
    delay(10000000);
    also overflows, as 10000 is about 3 hours, playing the same 2000-5000 Hz note for 3 hours would be rather painful.


    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    http://cpwiki.sf.net/void_main
    Your indentation is all messed up. You need to fix it. What IDE / editor do you use?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    http://cpwiki.sf.net/void_main
    Your indentation is all messed up. You need to fix it. What IDE / editor do you use?
    Given that the code looks like it would only work in Turbo C/C++, I expect the IDE is the Turbo C++ IDE.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Well, better to ask anyway :)
    And if it really is Turbo C/C++, then you really need to upgrade.
    Suggestions: http://cpwiki.sf.net/IDE
    My favorite is Visual Studio.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  2. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  3. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM

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