would anybody be able to help me with this?
bool isReflexive (const int mat[N][N], int size) {
// ????????????????????????
return 0; // fix return
}
// returns whether or not a Matrix is Symmetric
bool isSymmetric (const int mat[N][N], int size) {
// ????????????????????????
return 0; // fix return
}
// returns whether or not a Matrix is Transitive
bool isTransitive (const int mat[N][N], int size) {
// ????????????????????????
return 0; // fix return
}
// returns whether or not a Matrix is an Equivalence Relation
bool isEquivalenceRelation (const int mat[N][N], int size) {
// ????????????????????????
return 0; // fix return
}
C++ help please?
this would be easier to answer if you provided the formulas for each function... for example:
symmetric matrix:
aij = aji
then we can use this lines for the isSymmetric function:
bool isSymmetric (const int mat[N][N], int size) {
int i, j;
for(i=0;i%26lt;=size;i++ {
for(j=0;%26lt;=size;j++) {
if(mat[i][j] != mat[j][i]) {
return 0;
}
}
}
return 1;
}
this code checks every value inside our mat[][] array if the condition aij = aji is satisfied if it is.. we will return 1 if at least 1 of the values inside of mat[][] does not conform to the condition then we return 0
please show the conditions for reflexive, transitive and equivalence... but basing from the code above i think you can make your own algorithm for the other functions :D
good luck
Reply:You may contact a C++ helper live at website like
http://gionram.com/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment