[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: [PROGRAMMERING] C selvsving



Mikkel Meinike Nielsen wrote:
> kan også udføres, men det fungere ikke halt efter hensigten.
Så er det nok fordi det ikke er programmeret efter din hensigt.


> Hvis jeg trykker 'a' bliver programmet ved med at udføre
> komandoen "ls" igen og igen uden ophør.
Yeps.

> venus=getch();
Her læser du taste data, f.eks. 'a'

> do
> {
>    if(venus == 'a') system("ls");
>    if(venus == 'c') system("ps");
> } while (venus!='B');

Har du trykket 'a' vil du kører ls, du vil så checke om
venus ('a') er forskellig fra 'B', hvilke er sandt.
Du vil derfor starte forfra kører ls, teste om 'a'
er forskellig fra 'B', og køre loopet igen.

Kort sagt, hvad du mangler er at indsætte en
venus=getch(); i loopet således at du efter hver
ls, venter på at der trykkes en NY tast, og exitter
hvis tasten er 'B'.

-- 
  Mvh. Carsten Svaneborg
http://www.softwarepatenter.dk


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 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] *