Top 10 Programming Language to learn in 2023

Are you a programming enthusiast looking to stay ahead of the curve in 2023? With the ever-evolving tech landscape, keeping up with the Best Programming Language to learn can be a daunting task. Fear not, as we have compiled a list of the top 10 Programming Languages that you should consider learning in 2023. Python: This versatile language continues to dominate in 2023, with its ease of use, readability, and a vast library of modules. JavaScript: As web development grows increasingly popular, JavaScript remains a crucial player, with its ability to create dynamic and interactive web pages. Java: This language has stood the test of time and remains a popular choice for enterprise software development. C++: A staple in the gaming and systems development industries, C++ offers exceptional performance and memory management. Swift: Apple's preferred language for iOS app development, Swift continues to grow in popularity with its simplicity and reliability. R: As data science and machin...

C++ Program to Represent the Graph Using Adjacency Matrix | C++ Programming

 C++ Program to Represent the Graph Using Adjacency Matrix

#include <iostream>
#include <iomanip>
using namespace std;
// A function to print the adjacency matrix.
void PrintMat(int mat[][20], int n)
{
    int i, j;
    cout << "\n\n"
         << setw(4) << "";
    for (i = 0; i < n; i++)
        cout << setw(3) << "(" << i + 1 << ")";
    cout << "\n\n";
    // Print 1 if the corresponding vertexes are connected otherwise 0.
    for (i = 0; i < n; i++)
    {
        cout << setw(3) << "(" << i + 1 << ")";
        for (j = 0; j < n; j++)
        {
            cout << setw(4) << mat[i][j];
        }
        cout << "\n\n";
    }
}
int main()
{
    int i, j, v;
    cout << "Enter the number of vertexes: ";
    cin >> v;
    int mat[20][20];
    cout << "\n";
    // Take input of the adjacency of each pair of vertexes.
    for (i = 0; i < v; i++)
    {
        for (j = i; j < v; j++)
        {
            if (i != j)
            {
                cout << "Enter 1 if the vertex " << i + 1 << " is adjacent to "
                << j + 1 << ", otherwise 0: ";
                cin >> mat[i][j];
                mat[j][i] = mat[i][j];
            }
            else
                mat[i][j] = 0;
        }
    }
    PrintMat(mat, v);
    return 0;
}

Output

C++ Program to Represent the Graph Using Adjacency Matrix | C++ Programming


Comments

Popular posts from this blog

Array in C Programming | C Programming

C program to Find Cartesian Product of Two Sets | C programming

What is System? | SAD