| | |
save me from getting "F"
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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]
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]
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Solved Threads: 0
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
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
>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]
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]
•
•
•
•
Originally Posted by iamthwee
I would rather use the Sleep function than the stuff from <time.h>...
C++ Syntax (Toggle Plain Text)
clock
C++ Syntax (Toggle Plain Text)
sleep
•
•
•
•
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.
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#... バルサミコ酢やっぱいらへんで
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Solved Threads: 0
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
____
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
____
>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]
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]
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.
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.
バルサミコ酢やっぱいらへんで
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]
:lol:
[tries to recruit a java newbie]
http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld ™
[Tis simple as Pie]
•
•
•
•
Originally Posted by Drowzee
I knew there was something evil about you...

http://img476.imageshack.us/img476/5171/cut20ln.png
Piworld ™
[Tis simple as Pie]
![]() |
Other Threads in the C++ Forum
- Previous Thread: ERROR: Segmentation Fault
- Next Thread: Visual c++ toolkit 2003
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






