New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
freivalds_algorithm .cpp #3607
base: master
Are you sure you want to change the base?
freivalds_algorithm .cpp #3607
Conversation
#include <iostream> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
using namespace std; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid this at all costs.
@@ -0,0 +1,104 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location of this file is incorrect. Also, your file extension seems detached from the name.
|
||
#include <iostream> | ||
#include <stdio.h> | ||
#include <stdlib.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not <cstdio>
or <cstdlib>
?
int n; | ||
cin >> n; | ||
cout << "Enter the 1st matrix: " << endl; | ||
double a[n][n]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::vector
, as variable length arrays (VLAs), are not part of standard C++.
bool flag = true; | ||
for (int i = 0; i < n; i++) | ||
{ | ||
if (abr[i][0] == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be clearer if:
{
if (abr[i] != 0)
flag = false
}
if (flag == true) | ||
cout << "True"; | ||
else | ||
cout << "False"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add newlines to the end of the output. Also, == true
is a redundant condition.
else | ||
cout << "False"; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra newline.
Fixes issue:
Changes: