Can we print user input string to the output window using outtextxy() in C++ language?

SDKING
@sdking-03Di1M โ€ข Oct 26, 2024

I have to querry about outtextxy() function.can i print the user input to the output window using outtextxy() function in c++ language????

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • rahul69

    @rahul69-97fAOs • Mar 21, 2013

    SDKINGI have to querry about outtextxy() function.can i print the user input to the output window using outtextxy() function in c++ language????

    Yes u can, just be sure to include graphics.h in your program๐Ÿ˜€ . By the way Did u tried using it? what problem did u faced while trying to use it?

  • SDKING

    @sdking-03Di1M • Mar 21, 2013

    yes i include graphics.h header file.....but when we having to print the input given by user at the specific location it is not work....

    i tryed this...
    #include<iostream.h>
    #include<conio.h>
    #include<graphics.h>
    void main()
    {
    char str[20];
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\\tc\\bgi.cpp");
    cout<<"Enter String:-";
    cin>>str;
    outtextxy(200,300,str);
    getch();
    }
     
     
    outtextxy(200,300,str); i having problem with this......
     
    //
    if i written like this-
    outtextxy(200,300,"HELLO");// it prints the HELLO string but it is static..
     
    //
     
    

    i want that quoted string given by user...
    plz...help me frnds...

  • rahul69

    @rahul69-97fAOs • Mar 22, 2013

    #-Link-Snipped-# , well in my opinion, it is better to use some other platform for graphics, as graphics.h is obsolete. Also I guess, u are using Turbo C++ , and I will recommend u to use some latest IDE like VC++ etc.
    Now coming to question:
    You are writing:

    initgraph(&gd,&gm,"c:\\tc\\bgi.cpp");
    

    It should be "bgi" instead of "bgi.cpp" as bgi is a folder.
    Hope it solves ur problem๐Ÿ‘

  • SDKING

    @sdking-03Di1M • Mar 24, 2013

    i also tryed this boss.....but does'nt work.........๐Ÿ‘Ž

  • rahul69

    @rahul69-97fAOs • Mar 25, 2013

    SDKINGi also tryed this boss.....but does'nt work.........๐Ÿ‘Ž

    Well that is strange, as this is working on my machine, maybe your compiler has some problem. Try uninstalling and re-installing your TC++.

  • Prateek Gupta

    @prateek-gupta-Vp5hwc • Apr 17, 2013

    SDKINGyes i include graphics.h header file.....but when we having to print the input given by user at the specific location it is not work....

    i tryed this...
    #include<iostream.h>
    #include<conio.h>
    #include<graphics.h>
    void main()
    {
    char str[20];
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\\tc\\bgi.cpp");
    cout<<"Enter String:-";
    cin>>str;
    outtextxy(200,300,str);
    getch();
    }
     
     
    outtextxy(200,300,str); i having problem with this......
     
    //
    if i written like this-
    outtextxy(200,300,"HELLO");// it prints the HELLO string but it is static..
     
    //
     
    
    i want that quoted string given by user...
    plz...help me frnds...



    try getting the input from the function gets()
    ex:- gets(str);
    or try function getline()
    ex:-getline(str,20);
    hope it will work but if doesn't then plz post the exact error which you r getting by the compiler.

  • SDKING

    @sdking-03Di1M • Apr 20, 2013

    thanx...it working fine...

  • Prateek Gupta

    @prateek-gupta-Vp5hwc • Apr 22, 2013

    Most welcome brudda ๐Ÿ˜€