Skip to content

Instantly share code, notes, and snippets.

View steveobbayi's full-sized avatar

Steve Obbayi steveobbayi

View GitHub Profile
#include <iostream>
using namespace std;
int squareThis(int x){
return x*x;
}
int main(){
cout << squareThis(2); // returns 4
#include <iostream>
using namespace std;
int squareThis(int x){
return x*x;
}
double squareThis(double x){
return x*x;
#include <iostream>
using namespace std;
template <typename T> // add this line
T squareThis(T x){ // replace all occurrences of the type with "T"
return x*x;
}
int main(){
#include <iostream>
using namespace std;
template <typename T> // remember this line makes the class a template
class MyVector{
T a[10];
int count;
public:
var targetWidth = 768;
if ( $(window).width() &gt;= targetWidth) {
//Add your javascript for screens wider than or equal to 768 here
}
else {
//Add your javascript for screens smaller than 768 here
}
$(document).ready(function(){
var targetWidth = 768;
if ( $(window).width() &gt;= targetWidth) {
//Add your javascript for screens wider than or equal to 768 here
}
else {
//Add your javascript for screens smaller than 768 here
}
});
$(window).load(function(){
var targetWidth = 768;
if ( $(window).width() &gt;= targetWidth) {
//Add your javascript for screens wider than or equal to 768 here
}
else {
//Add your javascript for screens smaller than 768 here
}
});
w = document.documentElement.clientWidth || document.body.clientWidth || window.innerWidth;
var targetWidth = 768;
if ( w &gt;= targetWidth) {
//Add your javascript for screens wider than or equal to 768 here
}
else {
//Add your javascript for screens smaller than 768 here
}
window.onload=function(){
w = document.documentElement.clientWidth || document.body.clientWidth || window.innerWidth;
var targetWidth = 768;
if ( w &gt;= targetWidth) {
//Add your javascript for screens wider than or equal to 768 here
}
else {
//Add your javascript for screens smaller than 768 here
}
};
set<int>::iterator i;
set<int>::const_iterator ci;