ARST2 - scanf"%d"&p>cid for(i=0;i<=count;i if(p>cid==s[i>cid printf"\nThe customer details are\n"

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> # #define max 10 # struct customer { int cid; char name[30]; }; } void add(struct customer a[], int *c) { //add } /*void del() { //delete printf("Enter the customer id to be deleted"); scanf("%d",&p->cid); for(i=0;i<=count;i++) { if(p->cid==s[i]->cid) { printf("\nThe customer details are \n"); printf("Id:%d\n",s[i]->cid); printf("Name:%s\n",s[i]->name); while(i<count) { s[i]=s[i+1]; i++; } count--; y=1; break; } } if(y==0) { printf("\nThe customer id does not exist"); } } void modify() { //modify printf("Enter the customer id which is to be modified"); scanf("%d",&p->cid); for(i=0;i<=count;i++) { if(p->cid==s[i]->cid) { printf("\nThe customer details are \n"); printf("Id:%d\n",s[i]->cid);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
printf("Name:%s\n",s[i]->name); printf("\nEnter The new customer NAME:"); scanf("%s",p->name); s[i]=p; y=1; break; } } if(y==0) { printf("\nThe customer id does not exist"); } } void display() { //display printf("Enter the customer id to be displayed");
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: scanf("%d",&p->cid); for(i=0;i<=count;i++) { if(p->cid==s[i]->cid) { printf("\nThe customer details are \n"); printf("Id:%d\n",s[i]->cid); printf("Name:%s\n",s[i]->name); y=1; break; } } if(y==0) { printf("\nThe customer id does not exist"); } } */ void main() { struct customer s[10]; int choice,count=-1; clrscr(); printf("Enter the choice \n1-Add\n2-Delete\n3-Modify\n4-Display\n0-Exit\n"); scanf("%d",&choice); do{ switch(choice) { case 0:{break;} case 1:{ add( &s , &count); break; } case 2:{ //del(); break; } case 3:{// modify(); break; } case 4:{// display(); break; } default:{printf("\nInvalid CHOICE");} } printf("count:%d",count); printf("Enter the choice \n1-Add 2-Delete 3-Modify 4-Display 0-Exit\n"); scanf("%d",&choice); }while(choice!=0); getch(); }...
View Full Document

This note was uploaded on 10/25/2010 for the course CMPN SEM3 taught by Professor Thakur during the Fall '07 term at University of Mumbai.

Page1 / 3

ARST2 - scanf"%d"&p>cid for(i=0;i<=count;i if(p>cid==s[i>cid printf"\nThe customer details are\n"

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online