Ds1.docx

  • Uploaded by: sdbfvn
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ds1.docx as PDF for free.

More details

  • Words: 366
  • Pages: 6
/*A program to delete all the instances of a given key in a vector (1 dimensional array). Consider all the conditions.*/ #include using namespace std; int main() { long n,key; //input size of array cout<<"Enter size of the array - "; cin>>n;

//input key cout<<"Enter key - "; cin>>key;

//create array of size n long array[n];

// input elements in the array cout<<"Input elements of the array - "<<endl; for(long i=0;i>array[i];

//printing the input array cout<<"\nThe Original Array is - "<<endl; for(long i=0;i
//count of number of elements equal to key long count =0;cout<<endl;

//shifts every element back for(long i=0;i
//size of the array after deleting n=n-count;

//printing the new array cout<<"The New Array is -"<<endl; for(long i=0;i
//case handling where all elements equal to key if(n==0)cout<<"Array Empty"<<endl;

return 0; }

/*A program to delete all the duplicate instances in a vector (1 dimensional array). */ #include using namespace std; int main() { long n,key; //input size of array cout<<"Enter size of the array - "; cin>>n;

//create array of size n long array[n];

// input elements in the array cout<<"Input elements of the array - "<<endl; for(long i=0;i>array[i];

cout<<endl<<endl;

//printing the input array cout<<"The Original Array is - "<<endl; for(long i=0;i
for(long k=0;k
//count of number of elements equal to key

long count =0;

//shifts every element back for(long i=k+1;i
//size of the array after deleting keys n=n-count; } //printing the new array cout<<"The New Array is -"<<endl; for(long i=0;i
return 0; }

/*A program to check whether a given square matrix is orthogonal. */ #include using namespace std; int main() { long n; cout<<"enter size of square matrix:"; cin>>n; long array[n][n],ans[n][n];//array declaration cout<<"enter array elements:\n"; for(long i=0;i>array[i][j];//

taking array elements

} cout<<"array is:\n"; for(long i=0;i
for(long i=0;i
} }

long check=1; cout<<"\n\nA*A\':\n"; for(long i=0;i
if(check==0)cout<<"\nNOT Orthogonal"; else cout<<"\nOrthogonal"; return 0; }

More Documents from "sdbfvn"

Ds1.docx
November 2019 0