Program To Implement A Dynamic Table
/* Program To Implement A Dynamic Table. */ #include
#include
void main() { int stock[6][3]={ { 101,50,25 }, { 105,30,15 }, { 108,100,50 }, { 102,60,20 }, { 107,15,5 }, { 110,50,30 } }; int i,qty,icode,item; char ch,op; printf("\n item code \t currentstock\n"); for( i=0;i<6;i++ ) printf("\n%d \t %d",stock[i][0],stock[i][1]); do { printf("\n enter transaction type:(i)ssue,(r)eceive\n"); ch=getchar(); printf("\n enter item code \n"); scanf("%d",&icode); flg'n' ; if( ch=='i' ) { printf("\n enter quantity\n"); scanf("%d",&qty); for( i=0;i<6;i++ ) { if( stock[i][0]==icode ) { flg='y'; if( stock[i][1]>=qty) { stock[i][1]=stock[i][1]-qty; printf("%d units of item %d issued",qty,icode); if( stock[i][1]
=qty; if ( stock[i][1]>=stock[i][2] ) printf("\n item %d is above reorder level",icode); flg='y'; break; } } if( flg!='y' ) printf("\n invalid item code"); } else printf("\n invalid option"); printf("\n enter 'y' or 'Y' to continue...\n"); op=getchar(); } while( op=='y' || op=='Y' ); printf("\n item code is \t quantity \n"); for( i=0;i<6;i++ ) printf("\n %d \t %d",item[i][0],item[i][1]); getch(); }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/