On 9/4/07, remarknibor <[EMAIL PROTECTED]> wrote:
> I just run it from the command prompt in that window, so a console
> one. The code isn't very revealing, but this is the bit in which i'd
> like to embed the time check:
As Thomas remarked before, you won't be able to do what you want with
just plain ol' console code... you will need to design come
event-handling into your application. There are console APIs (like
ncurses) that can handle this for you, and provide you with text
windows, menus, I/O handling, etc. Or go the full route and write a
Windows application (which is event-based to begin with) using one of
the many toolkits available. I'd start with something like wxWindows
or fltk, they are relatively easy to use, unless you really want to
delve into the Windows SDK.
> system("cls");
> cout << "Essay writing task:\n\n";
> cout << "This task is about creative writing and imagination.
> Please write about\n";
> cout << "the following scenario, including as much detail as
> possible. The computer\n";
> cout << "will give you 10 minutes to write. Don't worry about
> spelling or grammar\n";
> cout << "but please try to write for the full 10 minutes. Do you
> have any questions?\n\n";
> cout << "If yes, please ask the experimenter\n";
> cout << "If no, press a key when you are ready to begin";
> getch();
> cout << endl;
>
> // How do you give them 10mins?
>
> string essay1, essay1extra;
> essay1.clear();
> system("cls");
> cout << "Essay writing task:\n\n";
> cout << "This task is about creative writing and imagination.
> Please write about\n";
> cout << "the following scenario, including as much detail as
> possible. The computer\n";
> cout << "will give you 10 minutes to write. Don't worry about
> spelling or grammar\n";
> cout << "but please try to write for the full 10 minutes.\n\n";
> cout << "\"Imagine meeting a supermodel. Please describe what
> happens and what you see, think and feel.\"\n\n" << endl;
> cout << "-> ";
> getline(cin,essay1);
>
> // In case they press return by mistake
> while(1) {
> essay1extra.clear();
> cout << "\nHave you finished writing your essay?\n";
> cout << "If yes, please type 'yes'.\n";
> cout << "If no (e.g. if you pressed return by mistake),
> please continue typing from\n";
> cout << "where you left off and the separate pieces will be
> joined together before analysis.\n" << endl;
> cout << "-> ";
> getline(cin,essay1extra);
> if(essay1extra == "yes" | essay1extra == "\'yes\'") {
> break;
> }
> essay1 += essay1extra;
> } // while loop
>
> system("cls");
> cout << "You have completed the essay writing task.\n";
> cout << "Now for the next task.\n\n";
> cout << "Press a key when you are ready to begin";
> getch();
> cout << endl;
>
> Thanks for having a look,
>
> Robin.
>
>
> --- In [email protected], "Brett W. McCoy" <[EMAIL PROTECTED]>
> wrote:
> >
> > On 9/4/07, remarknibor <[EMAIL PROTECTED]> wrote:
> >
> > > Yes, I'm using Windows and Dev-C++ at the moment. I've searched
> for
> > > WM_TIMER and SetTimer and things but not found any useful guide
> as to
> > > how to use them. Can you start me off in terms of the code I'd
> need
> > > to use to solve my problem?
> > > Basically, a user will be typing after I use 'getline(cin,essay)',
> > > and I want to stop them typing (and store what they have typed so
> > > far) when 10 minutes has passed.
> >
> > Is this a console application or a windows application? Can you show
> > more of your code?
> >
> > -- Brett
> > ------------------------------------------------------------
> > "In the rhythm of music a secret is hidden;
> > If I were to divulge it, it would overturn the world."
> > -- Jelaleddin Rumi
> >
>
>
>
>
> To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
> Yahoo! Groups Links
>
>
>
>
--
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi