943,891 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2793
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Apr 24th, 2006
0

Re: save me from getting "F"

You have two options.

You can use the <time.h> file.

Or Sleep from <windows.h>

Although, you haven't told us how you're handling the GUI...

http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld
[Tis simple as Pie]
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 24th, 2006
0

Re: save me from getting "F"

well what functions i have to use in time.h and i like to dispaly timer constantly in the same place..tell me what functions display timers like i have to start timer when the game starts and end it when it ends..
i have made cell class and made it friend of the main minesweeper class and then i`ve made input class and it is a friend too of the minesweeper class.plz reply me about the time.h class
Reputation Points: 10
Solved Threads: 0
Newbie Poster
neno14me is offline Offline
7 posts
since Apr 2006
Apr 24th, 2006
0

Re: save me from getting "F"

>i like to dispaly timer constantly in the same place

If you're using windows, you have to clear the screen to give the illusion of a constantly updating timer.

I assume you're doing this from a console window... although you haven't said. And you haven't told us which operating system you are using, so I'm assuming you're using windows.

>tell me what functions display timers like i have to start timer when the game starts and end it when it ends.

I would rather use the Sleep function than the stuff from <time.h>...

When you eventually decide to answer these questions...

How are you handling the GUI components of the game?

1. Use a rather hackish console display with <windows.h> commands
2. Use win32 -yuck
3. Use mfc - yucky
4. Use C# - yay.

What operating system are you using?

Then I can proceed to try answer your questions more specifically.

http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld
[Tis simple as Pie]
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 24th, 2006
0

Re: save me from getting "F"

Quote originally posted by iamthwee ...
I would rather use the Sleep function than the stuff from <time.h>...
Use the
C++ Syntax (Toggle Plain Text)
  1. clock
function. If you use the
C++ Syntax (Toggle Plain Text)
  1. sleep
function you will have to implement a clock function from scratch.

Quote originally posted by iamthwee ...
1. Use a rather hackish console display with <windows.h> commands
2. Use win32 -yuck
3. Use mfc - yucky
4. Use C# - yay.
A more reasonable comparison will be
1. Use a rather hackish console display with <windows.h> commands
        Adv - Simple, use C++
        Disadv - Ugly

2. Use win32 -yuck ( for newbies perhaps )
        Adv - faster, smaller executable, better control of the program, use C++
        Disadv - difficult if you don't have the guts and time

3. Use mfc
        Adv - Easier than using Win32 API, same look and feel, use C++, a lot of examples in the internet especially www.codeproject.com 
        Disadv - A slightly larger executable, less control on the program

4. Use Managed C++
        Adv - Easier than using Win32 API and perhaps MFC, same look and feel, use C++
        Disadv - Don't know much about this, but less number of examples in the net.

5. Use C# -
        Adv - None that I can think of but Iamthwee is welcome to disagree ;) 
        Disadv - Learn C#, port your C++ program to C#...
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Apr 24th, 2006
0

Re: save me from getting "F"

Hey Fellas,

I was wondering if I could write a simple code that erases the input display information once a user enters it. For example, I was going to write a simple program that asks for the user's name and then have the trailing display information erased from the program. Here's the code that I wrote:


#include <iostream>
using namespace std;

int main ()

{

char name [10];

cout << "May I have your name please?" << endl;

cin >> name;

cin.ignore();

cout << "Hey, " << name;

cin.get();

return 0;

}
When the user enters their information their screen would look like this:

May I have your name please? You
Hey, You

....so my question basically is how do I get rid of "May I have your name please?" so that it looks like this on their screen:

Hey, You

____
Reputation Points: 10
Solved Threads: 0
Newbie Poster
neno14me is offline Offline
7 posts
since Apr 2006
Apr 24th, 2006
0

Re: save me from getting "F"

>I was going to write a simple program that asks for the user's name and then have the trailing display information erased from the program.

You need to clear da screen... Tee he he. So you're using a console based GUI then?

http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld
[Tis simple as Pie]
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 24th, 2006
0

Re: save me from getting "F"

Check this exampleby Dave Sinkula. It is fairly simple. If you want a more complicated one, there is an example by me in the same thread. But I think Dave's example will do.

Edit: Looks like Dave's example will work only for overwriting the same line. Not sure though. You can find out yourself. If that is the case, maybe my example will be the only way.
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Apr 24th, 2006
0

Re: save me from getting "F"

If you come over to the java forums I'll show you how to make it pretty.
:lol:

[tries to recruit a java newbie]

http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld
[Tis simple as Pie]
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 24th, 2006
0

Re: save me from getting "F"

I knew there was something evil about you...
Reputation Points: 22
Solved Threads: 5
Posting Whiz in Training
Drowzee is offline Offline
244 posts
since Jul 2005
Apr 25th, 2006
0

Re: save me from getting "F"

Quote originally posted by Drowzee ...
I knew there was something evil about you...
Little ol' me, no?

http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld
[Tis simple as Pie]
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: ERROR: Segmentation Fault
Next Thread in C++ Forum Timeline: Visual c++ toolkit 2003





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC