Results 1 to 10 of 10

Thread: Hi.. Long Time No Seen!!!

  1. #1

    Thread Starter
    Hyperactive Member TupacShakur's Avatar
    Join Date
    Mar 2002
    Location
    Da Land Of Da Heartless...
    Posts
    493

    Talking Hi.. Long Time No Seen!!!

    It's been a while since my last post here!!
    anyways, i'm trying to create a "Press any key to continue" in my code...
    for example, i have to display 100 numbers.. each time the counter gets to 24, i should display the message, so the user gets to read the result... i think getch() is the way to do it, but i'm not sure about the exact code???
    Please, help!! Thanx...

    Here's the code i'm using by the way (the "Press..." only displays after the user presses a key.. starng, ha??!!):

    Code:
    #include <iostream.h>
    #include <conio.h>
    
    void main()
    {
    for (int i = 1; i <= 100; i++)
    	{
    	cout<<i<<endl;
    	if (i % 24 == 0)
    		{
    		cout<<"Press any key to continue";
    		getch();
    		}
    	}
    }
    "And Now I'm Lika Major Threat, Cause I Remind U Of The Things U Were Made To Forget!" - (2PAC)

    "Now They Label Me a Lunatic, Couldn't Care Less, Death or Success is What I Quest, Cause I'm Fearless!" - (2PAC)

    " There's a light at the end of every tunnel, just pray it's not a train!! "



    I am 100% addicted to Tupac. What about you?
    I am 24% addicted to Counterstrike. What about you?
    The #1 Tupac Fans Web Site | The Official Tupac Web Site

  2. #2
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166
    system("pause");

    does the job for you, it prints out the text automatically
    [p r a e t o r i a n]

  3. #3

    Thread Starter
    Hyperactive Member TupacShakur's Avatar
    Join Date
    Mar 2002
    Location
    Da Land Of Da Heartless...
    Posts
    493

    Talking PLZ!!

    i'm not sure how to use it??
    i mean combine it with my code, or use it stand alone??
    and should i include something??

    I'm really kind of new to C++, so excuse my lack of KNOWING!!!
    Thanx..
    "And Now I'm Lika Major Threat, Cause I Remind U Of The Things U Were Made To Forget!" - (2PAC)

    "Now They Label Me a Lunatic, Couldn't Care Less, Death or Success is What I Quest, Cause I'm Fearless!" - (2PAC)

    " There's a light at the end of every tunnel, just pray it's not a train!! "



    I am 100% addicted to Tupac. What about you?
    I am 24% addicted to Counterstrike. What about you?
    The #1 Tupac Fans Web Site | The Official Tupac Web Site

  4. #4
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166
    try this:

    PHP Code:
    #include <iostream>
    #include <conio> //not needed
    using namespace std//standard namespaces

    int main()
    {
    for (
    int i 1<= 100i++)
        {
        
    cout<<i<<endl;
        if (
    24 == 0)
            
    system("pause");
        }

    return 
    0;

    [p r a e t o r i a n]

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I think you need to include stdlib.h for that:
    PHP Code:
    #include <stdlib.h> 
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    better would be
    #include <cstdlib>
    cause we're talking C++ here...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Yep you're right CornedBee..
    the thing is.. I don't need to include anything now? Since I'm using VS.NET... is it true that you don't need to include any headers for it in .NET? or is it that I'm using namespace std; ?
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, I don't think so. Maybe you don't need to include anything for .NET, but I'd say you still have to include headers for normal programming.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    No I don't use managed extensions or whatever.. I just mean that I'm using VC7 (is there any difference between the includes needed for VC6 and VC7)
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, the CRT and C++ standard libraries stay roughly the same, as does the C++ syntax. There is no difference in including between VC6 and VC7. (I'd say, but I don't have VC7)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width