What do you want to save?
Add Code snippet
New code examples
-
C++ 2022-03-17 03:00:05
nested for loops pyramid c++
//WAP to print triangle pattern... LOGIC int num{}, i{1}; cin >> num; while (i <= num) { for (int space = 1; space <= (num - i); space++) { // space cout << " "; } for (int value = 1; value <= (2 * i -... Add solution -
C++ 2022-03-16 23:40:31
c++ check if odd or even
#include <iostream> using namespace std; int main() { int n; cout << "Enter an integer: "; cin >> n; (n % 2 == 0) ? cout << n << " is even." : cout << n << " is odd.";... Add solution -
Other 2022-03-16 19:40:15
vertical traversal of binary tree gfg
void getVerticalOrder(TreeNode* root, int hd, map<int, vector<int>> &mp) { // Base case if (root == NULL) return; mp[hd].push_back(root->val); getVerticalOrder(root->left, hd-1, mp); getVerticalOrder... Add solution -
C++ 2022-03-16 14:50:10
array header, <array>
#include <iostream> #include <array> using namespace std; int main() { array<int,3> myarray {10,20,30}; for (int i=0; i<myarray.size(); ++i) ++myarray[i]; for (int elem : myarray) cout << elem << '\n'; } Add solution