CrazyEngineers
  • turbo c++ question:text input in graphics mode

    confounded

    Member

    Updated: Oct 26, 2024
    Views: 1.4K
    I have a question... how i can get input from the user in graphics mode. I want the cursor placed directly after "Enter number here: " but I'm not able to do that using cin. even the gotoxy statement doesnt work in graphics mode. Is there any other function i should use?

    Also how can i display the number using outtextxy...it takes only string as argument?

    Here is my code:
    #include<stdio.h>
    #include<conio.h>
    #include<graphics.h>
    
    int main()
    {
    int num;
    int gd=DETECT, gm;
    initgraph(&gd,&gm,"c:\\tc\\bgi");
    settextstyle(1,0,2);
    outtextxy(100,100,"Enter number");
    cin>>num;
    outtextxy(100,200," The number is: ");
    cout<<num;
    getch();
    closegraph();
    }
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • confounded

    MemberJan 26, 2009

    okay i was extremely stupid...😒

    I should have given smaller numbers for gotxy arguments...oops.
    Anyway now that problem is solved.
    Are you sure? This action cannot be undone.
    Cancel
  • Adwait

    MemberMay 8, 2016

    I see....
    I have created a function in c++ which can be used to take input in graphics mode.

    If you want that please contact me on my email id. I will send you.

    My email id: #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register