Supercharge your code and productivity
#include<iostream>
#include<vector>
int main()
{
std::vector<int> vec;
// Append elements
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
std::cout << "Vector contents: ";
for (int value : vec)
{
std::cout << value << " ";
}
std::cout << "\n";
// Insert and delete elements
vec.insert(vec.begin(), 0); // Insert 0 at the beginning
vec.erase(vec.begin() + 2); //Remove the 2nd index element
std::cout << "Vector after insertions and deletions: ";
for (int value : vec) {
std::cout << value << " ";
}
std::cout << "\n";
return 0;
}
Need to code like a Pro
Integration with Basic languages
This site is designed to provide you code of Punjab University (CS/IT) Lab Manuals easily.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
int age;
cout << "Enter your name: ";
getline(cin, name);
cout << "Enter your age: ";
cin >> age;
cout << "Hello, " << name << endl;
cout<<"You are " << age <<"years old.";
return 0;
}
Boost your Skills
Streamline your workflow with our platform and effortlessly write cleaner and better code