Skip to content

Instantly share code, notes, and snippets.

View Zulqurnain's full-sized avatar
🎯
Focusing

Zulqurnain Haider Zulqurnain

🎯
Focusing
  • Rave Business Systems LLC
  • Lahore, Pakistan
View GitHub Profile
@Zulqurnain
Zulqurnain / C++ : String Permutations
Created December 21, 2013 20:19
Take Any String and save its permutations in a file
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;
class Permute{
int start,end,count;
char *f,*str;
public:
Permute(char* st,char* fn){ // fn = file name / full path with name
@Zulqurnain
Zulqurnain / C++: Square Root
Created December 17, 2013 15:48
Custom Square Root Function in c++
#include<iostream.h>
double my_sqrt(int,int);
int main()
{
int num,root; // root can be 2,3,4...
//root depends you want to take square , cube , 4rth , 5th , nth root of any number
cout<<"Enter Your Value N :=:"; cin>>num; cout<<"\n";
if(num<0){
cout<<"Square Root of -ve entry in real Number is Not Possible\n";
@Zulqurnain
Zulqurnain / C++ : Float to Fraction
Last active April 10, 2016 18:58
Program to Convert Mixed Number into Numerator and Denominator Form.
#include <iostream>
using namespace std;
int main(void){ // coded by Zuqurnain jutt
int num=1,den=1,t1=1;
double n=0.25,t2=1; // n can be any number
for(int i=1;;i++){
t2=i*n;
t1=t2;
t2-=t1;
#include <iostream.h>
#include <string.h>
class student
{
char *arr[5];
public:
student(void){
for(int i=0;i<5;i++){
@Zulqurnain
Zulqurnain / C++ : Array of Pointers in Class
Created November 2, 2013 12:34
Private array of pointers set in main !
#include <iostream.h>
#include <string.h>
class student
{
char *arr[5];
public:
void setarr()
{
@Zulqurnain
Zulqurnain / C++ : Dividing Without Divide Operator
Created September 29, 2013 10:57
Write A C++ Code which perform division of two Integers without Using / (divide operator) .
#include <iostream.h>
#inlcude <math.h>
int main(){ // Done By Zulqurnain jutt
double Numerator , Denominator , Result;
cout<<"Enter Numerator :=:"; cin>>Numerator;
cout<<"Enter Denominator :=:"; cin>>Denominator;
@Zulqurnain
Zulqurnain / C++ : Prime Checker
Created September 22, 2013 13:30
Program To Check Entered Number is prime or not !
#include <iostream.h>
int main(){ // Simple Prime Checker
int n;
cout<<"Enter Your Number :=:"; cin>>n;
/*Logic is simple ! if a number is divisible by more than 2 times ,, when approaching it from 1 to n then
its not prime else it is prime .
*/
int t=1,i=0;
@Zulqurnain
Zulqurnain / C++ : Deci To Hex
Last active December 23, 2015 14:29
C++ Code to convert Decimal To Hexa !
#include <iostream.h>
int main(){
int Deci,i=0;
int THex[100]; // Reason To Use : We Need A,B,C,D,E character To Represent Value of HEX
char Hex[100]; // Stores HEX
cout<<"Enter Decimal Number :=:"; cin>>Deci;
int Current_r=Deci , Current_q=Deci;
while(Current_q>=16){ // getting all remainders in array Reversed
@Zulqurnain
Zulqurnain / Problem#5
Created September 19, 2013 13:34
Write A Program which Inputs a Number and Tell Us The Following Details : *Positive or Negative *Even or Odd *Perfect or Prime or Not both *Number Or a Character Note : Input Can be a Character so you should perform all check on the ASCII of that character .
#include <iostream.h>
#include <stdlib.h>
int main(){ // By Zulqurnain jutt
int n;
char c[100];
cout<<"Enter Your Number :=:"; cin>>c;
for(int it=0,Fail=0,Pass=0;c[it]!='\0';it++){
@Zulqurnain
Zulqurnain / C++ Examples#1
Created September 18, 2013 15:31
Seekg() , Tellg() , Seekp() , Seekg()
#include <iostream.h>
#include <fstream.h>
int main()
{
ofstream fout;
int i; char ch;
// File opening in output mode both
fout.open("d:/test.txt",ios::in);
if(!fout)