Skip to content

Instantly share code, notes, and snippets.

View VizShaT's full-sized avatar
🎯
Focusing

Vijay Shankar Gupta VizShaT

🎯
Focusing
View GitHub Profile
<activity android:name="ShareActivity">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intern.category.DEFAULT"/>
<date android:mimeType="text/plain"/>
</intent-filter>
</activity>
@VizShaT
VizShaT / FibonacciSeries.cpp
Last active September 13, 2016 13:12
Fibonacci Series
#include <iostream>
using namespace std;
int fibresult[100];
int fib(int n){
if(n==0)
return 0;
else if(n==1)
return 1;
@VizShaT
VizShaT / ride.cpp
Last active August 2, 2016 11:47
1.1.1 Ride USACO
/*
ID: vijay.i2
PROG: ride
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
@VizShaT
VizShaT / gift1.cpp
Last active August 2, 2016 11:46
1.1.2 Gift1 USACO
/*
ID: vijay.i2
PROG: gift1
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
using namespace std;
@VizShaT
VizShaT / insertionSort.c
Created June 15, 2016 07:35
Insertion Sort
#include<stdio.h>
void InsertionSort(int a[], int n)
{
int i,j, temp;
for(i=0; i<=n-1; i++)
{
temp = a[i];
j = i;
while(a[j-1] > temp && j>=1)
@VizShaT
VizShaT / OperatorOverloading.cpp
Last active October 14, 2021 07:06
Operator Overloading in C++
#include <iostream>
using namespace std;
class Complex {
private:
int real, imag;
public:
Complex(int r = 0, int i = 0) { real = r, imag = i; }
// This is automatically called when '+' is used with
// between two Complex objects
@VizShaT
VizShaT / count_one.cpp
Last active August 2, 2016 11:44
Bit Manipulation
#include <iostream>
using namespace std;
int count_one(int x){
int count = 1;
do{
x /= 2;
count++;
}while(x % 2 != 0);
return count;
@VizShaT
VizShaT / leapYear.cpp
Last active August 2, 2016 11:44
Leap Year checking
/*
http://ideone.com/flMEIl
*/
#include <iostream>
using namespace std;
bool leapYear(int n){
if(n % 400 == 0)
return true;
else if(n % 100 == 0)
@VizShaT
VizShaT / friday.cpp
Created June 20, 2016 16:18
1.1.3 Friday the Thirteenth
/*
http://ideone.com/RvRq8S
http://train.usaco.org/usacoprob2?a=id79oFP6BDM&S=friday
*/
#include <iostream>
using namespace std;
bool leapYear(int n){
if(n % 400 == 0)
@VizShaT
VizShaT / beads.cpp
Last active August 2, 2016 11:43
1.1.4 Beads
/*
PROG: beads
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {