1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C loop until keypressed help?

Discussion in 'C++' started by 3uPh0riC, Jun 25, 2008.

  1. 3uPh0riC

    3uPh0riC New Member

    Joined:
    Jun 25, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi i need help in C please. I need to run a loop until i press a key, any key doesnt matter. The loop needs to execute until i decide to press a key, not wait each cycle for me to press a key. If someone can help id appreciate thanx
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    What operating system are you using, and what compiler?
    If Windows, is it a Windows application or a console application?
     
  3. aali

    aali New Member

    Joined:
    Jul 16, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    Riyadh
    I can write the cod by C++

    take
    ...

    ..
    ..
    while(!cin.eof())
    {

    ..
    ...
    ...

    ..
    int n;
    cout<<"Please Enter a value or EOF to stop"<<endl;
    cin>>n;

    }
    //EOF in visual c++ ctrl+Z
    //EOF in Linux c++ ctrl+d
     

Share This Page