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



Kære C engle

mange tak for hjælpen. Jeg har prøvet mig frem og det nedenstående virkede. Det eneste som ikke virker er at få printet afskeds beskeden
"Tak for denne gang" kan nogen hjælpe mig med det?

Ang:  Kenneth Geisshirt forslag

>Ja, og måske skal du erstattet do-while med en while så programmet 
>afsluttet med det samme. 

Jeg prøvede med 

		
	while(1)     
	{
	venus=getch();	

		if(venus == 'a')	  
			system("ls");   
		
		if(venus == 'c')	  
			system("ps");   
		
		if(venus == 'B')	  
			break;  

	

	}

Men fik:
parser erro before `if´

Jeg prøvede også med:

	while( venus != 'B' );  
	{   
	refresh();      
	venus=getch();	

		if(venus == 'a')	  
			system("ls");   
		
		if(venus == 'c')	  
			system("ps");   
		

	}   

Det program kunne godt kompileres men det fungerede ikke når jeg tasteded "a" fik jeg kun en-og-anden hørbar aktivetet i computeren, 
men inge ting på skærmen. Nuvel alt dette er bare nysgærrighed. For
programmet her nedenfor fungere (ja altså med undtagelse af den
sidste printw)


#include curses.h

int main()
{
	int venus;
	
	initscr();
	cbreak();
	printw("Tryk B for at afslutte programmet!!!\n\n");
	
	
		
	do{   
	refresh();      
	venus=getch();	

		if(venus == 'a')	  
			system("ls");   
		
		if(venus == 'c')	  
			system("ps");   
		

	

	}while( venus != 'B' );    
	
	printw("\nTak for denne gang\n");
	
	endwin();

	return 0;
}

Mange tak for jeres hjælp.

/Mikkel

_____________________________________________________________
Get your FREE, LinuxWaves.com Email Now! --> http://www.LinuxWaves.com
Join Linux Discussions! --> http://Community.LinuxWaves.com


 
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] *