#include<iostream>
Saturday, May 31, 2025
Friends Pairing using Recursion in C++
Remove Duplicates using Recursion in C++
#include<iostream>
Friday, May 30, 2025
Book Library Management (University Question)
#include <iostream>
C. Create a C++ program that uses a function template to find the maximum value between two values of any data type.
#include <iostream>
using namespace std;
template<typename T>
T maxVal(T a, T b) {
return (a>b) ? a : b;
/*
if (a > b) {
return a;
} else {
return b;
}
*/
/*
OR
return (a > b) ? a : b is same as if
(a > b)
return a;
else
return b;
*/
}
int main() {
int val1, val2;
cout << "enter first value : ";
cin >> val1;
cout << "\nenter second value : ";
cin >> val2;
int findMax = maxVal(val1, val2);
cout << findMax << " is the max value " << endl;
return 0;
}
Thursday, May 29, 2025
A. Create a C++ program that demonstrates function overloading.
D. Create a C++ class template named Pair that represents a pair of values. (University Topic of OOPs)
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// D. Create a C++ class template named Pair that represents a pair of values.
template <typename T>
class Pair {
private:
T A1;
T A2;
public:
Pair(T val1,T val2) {
A1 = val1; // initialize first ehe private variable then the Public variable
A2 = val2;
}
// display
void display() {
cout << "value A: " << A1 << " \nvalue B: " << A2 << endl;
}
};
int main() {
int x, y;
cout << "enter first value : ";
cin >> x;
cout << "enter second value : ";
cin >> y;
Pair<int> class1(x, y);
class1.display();
return 0;
}
Merge Sort in C++ (university dsa topic)
#include <iostream>
how to become red on codeforces by Errichto Algorithms | explained simply in a blog
Yes. I found an available transcript of the video and summarized it simply. The video is “How To Become Red Coder? (codeforces.com)” by Err...
-
public class Main { public static void printSolution(int sol[][]) { for (int i = 0; i < sol.length; i++) { for (...
-
Yes. I found an available transcript of the video and summarized it simply. The video is “How To Become Red Coder? (codeforces.com)” by Err...
-
import java.util.*; // Push element at the bottom of stack class StackB { public static String reverseString(String str) { ...