






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
in this i have covered all the practicals of discrete structure of sem 2 of delhi university.
Typology: Lab Reports
1 / 10
This page cannot be seen from the preview
Don't miss anything!







#include
if(i == j){ if(arr[i][j] != 0 ){ return false; } } } } return true; } bool checkmulti(){ for (int i = 0 ; i < size;i++){ for(int j = 0 ;j < size;j++){ if(arr[i][j] > 1 ){ return true; } } } return false; } }; int main(){ graph g; char ch = 'y'; do{ g.set_size(); g.setedges(); cout << endl; cout << "------------------------------------"; cout << endl; if(g.check()){ cout << "This is a complete graph."; } else{ if((g.checkmulti())){ cout << "THIS IS A MULTIGRAPH."; cout << endl; cout << endl; cout << "This is not a complete graph."; } else{ cout << "This is not a complete graph.";
cout << endl; cout << "-------------------------------------"; cout << endl; cout << "Do you want to re-execute the program(y/n): "; cin >> ch;}while(ch == 'y' || ch == 'Y'); getch(); }
else{ return (comb(n- 1 ,r- 1 ) + comb(n- 1 ,r)); } } //Driver code int main(){ int n,r,ch; char opt; do{ cout << "ENTER THE VALUE OF N: "; cin >>n; cout << "ENTER THE VALUE OF R: "; cin >> r; if(r > n){ cout << "ERROR: VALUE OF R IS GREATER THAN N."; cout << endl; cout << "DO YOU WANT TO CHECK AGAIN(Y/N)?: "; cin >> opt; } else{ cout << endl; cout << "COMBINATION : " << comb(n,r); cout << endl; cout << endl; cout << "DO YOU WANT TO CONTINUE(Y/N): "; cin >> opt; } }while(opt == 'Y'|| opt == 'y'); getch(); }