search and delete

search and delete - "; cin>>num; // =====...

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

View Full Document Right Arrow Icon
Q : writ a program that search for number and deleting this number then shifting array up ? #include<iostream.h> #include<stdio.h> void main() { int a[10],x=0,num,j,k=0; for (int i=0;i<10;i++)// reading array { printf("\n enter a[ %d ] = ",i); scanf("%d",&a[i]); } for (i=0;i<10;i++)//printing array printf("\n enter a[ %d ] = %d ",i,a[i]); //enter number you want to search cout<<endl<<"enter num =
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: "; cin>>num; // ===== serching ===== for(i=0;i<10;i++){ if(a[i]==num) { cout<<"\nthe num founded at a["<<x<<"] = "<< a[x] <<endl; //=== deleting num ==== for(j=i;j<10-1;j++){ a[j]=a[j+1]; } a[j]=0;} else cout<<"\nnumber not found"; } // =========== printing num ========== for (i=0;i<10;i++) { printf("\n enter a[ %d ] = %d ",i,a[i]); } }...
View Full Document

This note was uploaded on 10/16/2010 for the course ENG 2266e taught by Professor Aliraqi during the Spring '10 term at 4.1.

Page1 / 2

search and delete - "; cin>>num; // =====...

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

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