Skip to content

Instantly share code, notes, and snippets.

View theArjun's full-sized avatar

Arjun Adhikari theArjun

View GitHub Profile
@theArjun
theArjun / Class Template for Stack of Array.cpp
Last active September 28, 2018 04:02
Class Template for Stack of Array
#include<iostream>
#include<conio.h>
using namespace std;
template<class X>
class Stack{
private:
X index;
X pile[100];
@theArjun
theArjun / Form_Validation.htm
Last active September 28, 2018 04:01
Client Side Validation using REGEX
<!DOCTYPE html>
<html>
<head>
<title>Register</title>
</head>
<body>
<form action="#" method="POST" id = "myform">
<fieldset>
<legend>Fill up the form</legend>
<label>
@theArjun
theArjun / databaseConnect.php
Last active January 13, 2019 18:05
PHP Database Connect
<?php
$conn = mysqli_connect("localhost","root","");
if(!$conn){
die("Host connection failed.<br/>");
}else{
echo "Host connected.<br/>";
}
$create_db = "CREATE DATABASE authentication";
@theArjun
theArjun / OperatorOverloadingInC++.cpp
Last active January 13, 2019 18:04
Operator Overloading for '+' , '- ' and '='.
// Q. Write a program with class Distance to realize following main method.
// [Internal 2018 Spring - GCES]
#include<iostream>
using namespace std;
class Distance{
private:
int cm;
@theArjun
theArjun / PolarToCartesianAndViceVersa.cpp
Last active September 28, 2018 04:03
Polar Coordinates to Cartesian Coordinates and Vice Versa
#include<iostream>
#include<cmath>
#include<math.h>
using namespace std;
class Cartesian{
private:
float xCo, yCo;
public:
@theArjun
theArjun / MultipleInheritance.cpp
Last active January 26, 2019 18:07
Diamond Inheritance
#include<iostream>
#include<string>
using namespace std;
class University{
private:
string uname;
public:
University():uname("unspecified"){}
University(string u):uname(u){}
@theArjun
theArjun / Decimal To Binary.java
Last active October 20, 2018 12:33
Decimal Number To Binary Number System
class DecToBin{
public static void main(String[] args){
int dec = 64;
int bin=1,rem=0;// I assigned bin to 1 in this revision.
while(dec>1){ // I run the loop while dec is greater than 1 in this revision.
rem=dec%2;
bin=bin*10+rem;
dec=dec/2;
}
System.out.println("In Binary = "+bin);
@theArjun
theArjun / swapWithoutThirdVariable.py
Last active October 26, 2018 14:05
Swaps String Without Third Variable in Python
stringOne = str(input("Enter string one : "))
stringTwo = str(input("Enter string two : "))
print("\nBefore Swapping\n")
print("String One : %s"%(stringOne))
print("String Two : %s"%(stringTwo))
# Pre-Defined Method
# stringOne,stringTwo = stringTwo,stringOne
@theArjun
theArjun / Calculate.java
Created December 19, 2018 09:20
Implementation of Copy Constructor in Java
// www.github.com/thearjun
class Calculate
{
int num1, num2;
Calculate(int number1, int number2)
{
num1 = number1;
num2 = number2;
@theArjun
theArjun / CountsFileInDirectory.java
Created January 10, 2019 14:11
Java Program to Count and Display only Files of specified Directory
import java.io.File;
class CountsFile{
private static int count; // Count variable to count the no of files.
public static void count(){
count++; // Every time the method is envoked, count increases by 1.
}
public static int getCount(){
return count; // Getter for count.
}