Menu Help using C (Switch)

Status
Not open for further replies.

cnandha19

Member level 3
Joined
Aug 28, 2015
Messages
59
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
604
When 2 Pressed,
Delete Product : 1. Yes / 2. No
If 1 pressed,
Confirm : 1.Yes / 2. No
If 1 pressed, delete product Info
is it correct way ??

Code:
      int deleteproductrecords();

int deleteproductrecords()
{
	
	int ret =0;
	lcdClear();
	lcdMoveCursor(0,0);
	lcdPrintStr("Delete Product rec:");
	lcdMoveCursor(1,6);
	
	lcdPrintStr("1.Yes:");
	lcdMoveCursor(2,6);
	lcdPrintStr("2.No:");
	
	while(1)
	{
		
		ret = READ_SWITCHES();
		
		
		 if(ret == '1')
		 {
			 lcdClear();
			 lcdMoveCursor(0,0);
			 lcdPrintStr("Delete product rec:");
			 lcdMoveCursor(2,7);
			 lcdPrintStr("1.Yes");
			 
			 
		 }
		 
		 if(ret == enterkeystore)
		 {
			 
			 
			 lcdClear();
			 lcdMoveCursor(0,0);
			 lcdPrintStr("Delete product rec:");
			 lcdMoveCursor(2,7);
			 lcdPrintStr("Deleted");
		 }
		 
		 if(ret == nextkeystore)
		 {
			 
			 
			 lcdClear();
			 lcdMoveCursor(0,0);
			 lcdPrintStr("Delete product rec:");
			 lcdMoveCursor(2,7);
			 lcdPrintStr(" Not Deleted");
		 }
		 
		 if(ret == '2')
		 {
			 
			 
			 lcdClear();
			 lcdMoveCursor(0,0);
			 lcdPrintStr("Delete product rec:");
			 lcdMoveCursor(2,7);
			 lcdPrintStr("2.No");
			 
		 }
		
		else if(ret == '3')
		{
			return;
		}
		
	}
	
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…