[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] getch() virker ikke



OK, det sidste forstår jeg ikke meget af.

Så vidt jeg ved venter getch ikke på en enter. I hvert fald ikke under
andre platforme, dvs. under windows C++.

Jeg anvender i øvrigt Kdevelop til at skrive, kompile og linke mine
programmer.

Egon Petersen
On Thu, 2003-12-04 at 14:24, Hans Schou wrote:
> On Thu, 4 Dec 2003, Egon Petersen wrote:
> 
> > Jeg er ved at lære mig OOP med C++. Jeg har fået en opgave der
> > ligesom lægger op til at man skal bruge getch().
> 
> Måske, men default så venter getch() på en ENTER.
> Se lige: 
> http://www.sslug.dk/~chlor/keypressed.c
> Der skal man ikke taste ENTER.
> 
> > Når jeg kompilerer mit program under Kdevelop går det fint, men når
> > jeg skal linke kommer følgende fejl:
> 
> 	g++ -lcurses -o main main.cpp
> eller
> 	g++ -lncurses -o main main.cpp
> 
> Et par flere småting:
> 
> --- main.cpp.orig       2003-12-04 14:08:55.000000000 +0100
> +++ main.cpp    2003-12-04 14:20:15.000000000 +0100
> @@ -1,6 +1,5 @@
>  #include <iostream>
>  using namespace std;
> -#include <curses.h>
> 
>  class tollBooth
>  {
> @@ -35,14 +34,14 @@
>  int main()
>  {
>    tollBooth GoldenGate;
> -  char valg= ' ';
> +  int valg= ' ';
> 
>    cout << "Tast '1' når der betales og '2' når der ikke betales" <<
>  endl;
> -
> -  while (valg != 0x27)
> +
> +  while (valg != 'q')
>    {
> -    valg = getch();
> +    valg = getchar();
>      switch (valg)
>      {
>        case '1':GoldenGate.payingCar();break;
> 
> /hans
> -- 
> Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
> Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
> --------------------------------------------------------------
> Hvis du har "stjålet" software, så skulle du skamme dig og
> aflevere det tilbage!




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:10 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *