Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kyathamsrikanth
Copy link

Fixes issue:

Changes:

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
Copy link
Member

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 @@
/*
Copy link
Member

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>
Copy link
Member

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];
Copy link
Member

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)
Copy link
Member

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";
Copy link
Member

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";
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants