Дана квадратная таблица 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;
}

28 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

  14. Informative Site… Hello guys here are some links that contains information that you may find useful yourselves. It’s Worth Checking out 급전

  15. Absolutely pent subject matter, appreciate it for selective information .대출

  16. Your writing style is both engaging and informative.대출

  17. I’m impressed by the depth of your analysis.대출

  18. I’m impressed by your ability to explain complex concepts in a clear and concise manner.대출

  19. This is exactly what I needed to read today.대출

  20. Your writing has a real impact on me.급전

  21. It’s very interesting! If you need help, look here: link building

  22. Your insights have given me a lot to think about.대출

  23. This post resonated with me deeply. Thank you for sharing your insights.대출

  24. Fantastic read! You’ve explained everything so clearly.echozone

  25. I really appreciate the thorough analysis you’ve provided here.swiftnook

  26. I really appreciate the thorough analysis you’ve provided here.swiftnook

  27. You consistently produce high-quality content that is both informative and enjoyable to read. This post was no exception. Keep it up!pulsepeak

Leave a Comment