Results 1 to 3 of 3

Thread: Program running error in cpp shell

  1. #1

    Default Program running error in cpp shell

    I got the output as

    Enter your string : The string is : dfgd

    for the program below. The text "Enter your string " appear below the input section rather it requires being above the input of string. Any please help

    using namespace std;

    class activity4
    string chkSt;
    void stFn(string myStr)
    cout<<"The string is : "<<myStr;


    int main()
    activity4 act;
    char str[30], ch;
    int i = 0;

    cout<<"Enter your string : ";

    while(ch != '\n')
    ch = getchar();
    str[i] = ch;
    str[i] = '\0';
    return 0;

  2. #2
    Join Date
    Jul 2008
    Thanked 52 Times in 50 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows

    Default Re: Program running error in cpp shell

    Hi, you can try to flush cout:
    Qt Code:
    1. cout<<"Enter your string : " << std::flush;
    To copy to clipboard, switch view to plain text mode 


  3. #3
    Join Date
    Dec 2017
    Qt products

    Default Re: Program running error in cpp shell

    You need to run an engine testing of the programme. Here's the how and where calculation engine case. Your program will run flawlessly after this.

Similar Threads

  1. C++ runtime Error in Running Program
    By ramin.lich in forum Newbie
    Replies: 2
    Last Post: 4th September 2014, 09:31
  2. Running shell script with as super user in N900
    By spylvas in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 30th April 2010, 01:05
  3. Program running error in qtopia 2.2.0
    By halloworld in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 15th February 2009, 09:23
  4. running shell command from C++ code problem
    By alex chpenst in forum Qt Programming
    Replies: 4
    Last Post: 31st July 2008, 10:41
  5. Replies: 1
    Last Post: 17th May 2006, 00:23


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.