Thread: trouble

  1. #1

    Exclamation trouble

    i wrote program that takes its inputs in three lines.

    int main(void)
    {value();/*this reads first line*/
    pos(); /*reads second line*/
    target; /*reads third line*/

    but i got a proble about this functřons.Becouse the main program completes its execution with asking me the third input line it stops execution.

    how can i stop this?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Do you mean you want it to keep looping until the user stops it? If so, just put your code inside a while or for loop.

    The following will cause an infinite loop, so the user has to kill the program to stop it. It's a bit nasty doing things this way, but it demonstrates the principle nicely.

    x = 1;
    while (x == 1)
    Or, do you mean the third function is not executed? You do realise that you have the brackets missing from it:
    >target; /*reads third line*/

    should be:
    >target(); /*reads third line*/
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with assignment in C
    By mohanlon in forum C Programming
    Replies: 17
    Last Post: 06-23-2009, 10:44 AM
  2. Replies: 6
    Last Post: 01-03-2007, 03:02 PM
  3. Is it so trouble?
    By Yumin in forum Tech Board
    Replies: 4
    Last Post: 01-30-2006, 04:10 PM
  4. trouble scanning in... and link listing
    By panfilero in forum C Programming
    Replies: 14
    Last Post: 11-21-2005, 12:58 PM
  5. C++ program trouble
    By senrab in forum C++ Programming
    Replies: 7
    Last Post: 04-29-2003, 11:55 PM