Skip to content

Instantly share code, notes, and snippets.

View soachishti's full-sized avatar
💭
Away

Owais soachishti

💭
Away
View GitHub Profile
@soachishti
soachishti / TicTacToe.cpp
Last active August 29, 2015 14:10
Tic Tac Toe
/*
* Name: Syed Owais Ali Chishti
* Tic Tac Toe
* Major: BS(CS)
*/
#include<iostream>
#include<cstdlib>
#include<conio.h>
#include<iomanip>
@soachishti
soachishti / SnakeGame.cpp
Last active August 29, 2015 14:10
Snake Game
/*
* Name: Syed Owais Ali Chishti
* Task: Snake Game with ladder
* Major: BS(CS)
*/
// Help from: http://gamedev.stackexchange.com/questions/33786/snake-game-logic
#include <iostream>
#include <conio.h> // getch()
@soachishti
soachishti / hangman.cpp
Last active December 3, 2015 18:17
Hanging Man
/*
* Name: Syed Owais Ali Chishti
* Task: Hangman
* Major: BS(CS)
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
@soachishti
soachishti / LabLask001.cpp
Last active October 10, 2015 10:07
Input only numbers, using getch()
/*
* Name: Syed Owais Ali Chishti
* Roll No: P14-6011
* Major: BS(CS)
* Course: Computer Programming Lab
* Task: 001
*/
#include<iostream>
#include<conio.h> // _getch()
@soachishti
soachishti / RightAndLeftButton.cpp
Created February 4, 2015 19:08
Move in console by pressing right and left
/*
PRESS RIGHT LEFT BUTTON AND SEE RESULT
*/
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
/*
@soachishti
soachishti / str2binANDbin2str.cpp
Last active October 10, 2015 10:04
Convert String to binary and vice verse
#include <iostream>
#include <bitset>
using namespace std;
string stringToBinary(string str) {
string binary;
for (size_t i = 0; i < str.size(); i++)
{
binary += bitset<8>(str.c_str()[i]).to_string();
@soachishti
soachishti / getCPUClock.cpp
Created February 5, 2015 11:39
Get CPU Clock using Assembly Require 50 Cycle to run
//://stackoverflow.com/questions/275004/c-timer-function-to-provide-time-in-nano-seconds
#include <time.h>
#include <iostream>
#include <string>
using namespace std;
inline __int64 GetCpuClocks()
{
// Counter
@soachishti
soachishti / txt2bin.cpp
Last active August 29, 2015 14:20
Text to Binary Viewer (Colored)
// http://stackoverflow.com/questions/10184178/fastest-way-to-convert-string-to-binary
#include <iostream>
#include <bitset>
#include <string>
#include <windows.h>
using namespace std;
enum Color { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE};
@soachishti
soachishti / callback-in-c++
Last active October 10, 2015 10:03
Callback C++
// Source: http://en.wikipedia.org/wiki/Callback_(computer_programming)
#include <iostream>
#include <cstdlib>
using namespace std;
void callback(int (*f)(int i , int b)) {
f(10,20);
//cout << f(10,20);
}
@soachishti
soachishti / CPdhQuery.cpp
Last active August 29, 2015 14:26
PDH Helper Class (Performance Counter)
/*
Source: https://askldjd.wordpress.com/2011/01/05/a-pdh-helper-class-cpdhquery/
*/
#include <windows.h>
#include <pdh.h>
#include <pdhmsg.h>
#include <string>
#include <map>
#include <sstream>