Specific programming tip

Posted by: John Carter 26.09.2024 22:20
Post: The 18. post
Title: C++ Avoid Including Multiple Libraries
Language: C++
Description:
Code Example:
Generally, we include libraries at the start of the C++ code to perform certain operations as shown below.


#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main()
{

    cout << "GFG!";
    return 0;
}


This “iostream”  library performs the input-output operations in C++ code.

#include <iostream>

The “vector” library allows us to perform operations on vectors.

#include<set>

This includes all the standard libraries required in the program. So, we can avoid adding these many libraries separately to keep code as efficient and effective as possible.

#include<bits/stdc++.h>