Дана квадратная таблица a[1:n,1:n]. Найти номер строки, содержащей наибольшее число нулей- C++(Си)

#include <iostream>

using namespace std;

int main()
{
    setlocale (LC_ALL, "Russian");
    int n, i, j;
    std::cout<<"Введите размерность:\nn = ", std::cin>>n; 
    int **matr = new int*[n];
    for(i = 0; i < n; ++i)
        matr[i] = new int[n];
    system("cls");
    std::cout<<"Введите матрицу размерностью "<<n<<'x'<<n<<":\n";
    for (i = 0; i < n; ++i)
        for(j = 0; j < n; ++j)
            std::cin>>matr[i][j];
    std::cout<<"Введенная матрица:\n";
    for(i = 0; i < n; ++i, std::cout<<'\n')
        for(j = 0; j < n; ++j)
            std::cout<<matr[i][j]<<' ';
    int *mas = new int[n]; 
    for(i = 0; i < n; ++i)
    {
        mas[i] = 0;
        for(j = 0; j < n; ++j)
            if(matr[i][j] == 0)
                mas[i]++;
    }
    int max = mas[0], index(0);
    for(i = 1; i < n; ++i)
        if(mas[i] > max)
        {
            max = mas[i];
            index = i;
        }
    std::cout<<"Номер строки, содержащей наибольшее число нулей: "<<index<<'\n';
    system("pause");
    return 0;
}

13 Thoughts to “Дана квадратная таблица a[1:n,1:n]. Найти номер строки, содержащей наибольшее число нулей- C++(Си)”

  1. Wow, superb weblog format! How lengthy have you ever been running a blog
    for? you make blogging look easy. The full glance of your site is
    excellent, let alone the content material! You can see similar here dobry sklep

  2. I do consider all of the ideas you have offered for
    your post. They’re very convincing and will certainly work.
    Nonetheless, the posts are very short for novices. May just you please lengthen them a little from next time?
    Thank you for the post. I saw similar here: Sklep online

  3. It’s in point of fact a great and helpful piece of information. I
    am glad that you simply shared this helpful info with us.
    Please keep us informed like this. Thanks for sharing.
    I saw similar here: Sklep

  4. I am curious to find out what blog system you’re using?

    I’m experiencing some small security issues with my latest website and I would like to find something more risk-free.
    Do you have any recommendations? I saw similar here:
    Sklep

  5. Keep on writing, great job! I saw similar here: Sklep online

  6. Hey there! Do you know if they make any plugins to help with Search Engine
    Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
    very good results. If you know of any please share.

    Thank you! You can read similar art here: Sklep internetowy

  7. Hi there! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results.
    If you know of any please share. Thanks! You can read similar blog
    here: Sklep internetowy

  8. It’s very interesting! If you need help, look here: ARA Agency

  9. It’s very interesting! If you need help, look here: ARA Agency

  10. Hi! Do you know if they make any plugins to assist with SEO?

    I’m trying to get my blog to rank for some targeted keywords but I’m not
    seeing very good success. If you know of any please share.

    Cheers! You can read similar text here: Dobry sklep

  11. Hello there! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
    very good results. If you know of any please share.
    Thanks! You can read similar article here: Ecommerce

  12. Hello! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted
    keywords but I’m not seeing very good results. If you know
    of any please share. Thank you! You can read
    similar text here: Link Building

  13. Hi there! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my website to rank for some targeted keywords but I’m not seeing very good
    results. If you know of any please share. Many thanks!
    I saw similar text here: Link Building

Leave a Comment