Newbie problem with console!

This is a discussion on Newbie problem with console! within the C++ Programming forums, part of the General Programming Boards category; Hey, everyone that can help I appreciate it. Every program I write no matter how simple the Console box when ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    2

    Newbie problem with console!

    Hey, everyone that can help I appreciate it.
    Every program I write no matter how simple the
    Console box when you printf only stays on my monitor
    for a second no matter what I do what can I do to make it stop
    so I can see it for more than 1 second?

  2. #2
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    go here, there's the programming FAQ that's very helpful
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    and try here
    http://faq.cprogramming.com/cgi-bin/...&id=1043284385
    and then of course tutorials
    Last edited by linucksrox; 05-02-2006 at 12:02 AM.
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    enter cin.get or getch() before return zero to wait a key press, this pauses the output so you can see the results of the program. But look at the FAQ board first mind - pete

  4. #4
    Registered User
    Join Date
    Dec 2005
    Location
    192.168.1.1
    Posts
    4
    Code:
        system("PAUSE");
        return EXIT_SUCCESS;
    at the end of the main function.

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,077
    Quote Originally Posted by sasuke12
    Code:
        system("PAUSE");
        return EXIT_SUCCESS;
    at the end of the main function.
    On second though, no. Don't do this. Use cin.get() and keep your code standard like the rest of the world.
    Sent from my iPadŽ

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    standard
    Ah, that word



    The point is, command-line apps are (and should very well be) built to run exactly like command-line apps, including the immdiate termination! So there isn't some built-in magic wand to pause your program.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem w/ console application compadibility
    By DarkMortar in forum C Programming
    Replies: 2
    Last Post: 05-16-2006, 08:13 PM
  2. Problem with windows console when running.
    By RealityFusion in forum C++ Programming
    Replies: 5
    Last Post: 08-07-2003, 09:56 PM
  3. Dos Console Problem....
    By Intimd8r in forum C++ Programming
    Replies: 5
    Last Post: 07-26-2003, 05:44 PM
  4. newbie coding problem
    By rippascal in forum C++ Programming
    Replies: 10
    Last Post: 01-08-2002, 11:45 PM
  5. Console Program Problem
    By Breach23 in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2001, 01:35 AM

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