Skip to content

Instantly share code, notes, and snippets.

View rsmahmud's full-sized avatar

Rasel Mahmud rsmahmud

View GitHub Profile
@rsmahmud
rsmahmud / morse_code.c
Last active January 4, 2017 17:42
Morse Code
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#define MAX 49
char alpha[MAX] ="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789.,:?'-/()\"@=";
char *morse[MAX]={ ".-","-...","-.-.","-..",".","..-.","--.",
"....","..",".---","-.-",".-..","--","-.",
"---",".--.","--.-",".-.","...","-","..-",
"...-",".--","-..-","-.--","--..",
#include<stdio.h>
int main(){
int i,n,c=1,sum=0;
printf("\n Last number of series : ");
scanf("%d",&n);
if(n>0 && n%2){
printf("\n Series = ");
for(i=1; i<(n/2)+2; i++){
if(i==1)printf("1");
else printf(i%2?"+%d":"-%d",c);
#include<stdio.h>
int main(){
int i,n,c=1,sum=0;
scanf("%d",&n);
for(i=1; i<(n/2)+2; i++,c+=2)
i%2 ? sum += c : (sum -= c);
printf("Sum = %d",sum);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#define MAX 3
int *return_array(int x[], int y[],int count){
int i;
int *z = (int*)malloc(count);
for(i=0; i<count; i++)
z[i] = x[i] * y[i];
return z;
@rsmahmud
rsmahmud / reclaimWindows10.ps1
Created January 7, 2017 19:08 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@rsmahmud
rsmahmud / pacman_like_game.c
Created January 9, 2017 09:55
Simple Pacman Like Game with ASCII characters [No Graphics]
/** Simple Pacman Like Game **/
#include<stdio.h>
#include<conio.h>
//#include<stdlib.h> //if compiler asks
#define ROW 20
#define COL 80 //keep it min 50,max 80 for best look
#define MAX_GHOST 20
#define DOTS_FOR_POINT 10
/**
* Create a class named 'rotation'. it contains 4 variables of int type.
* Write a function to rotate their values with pass by ref. approach.
*/
#include<iostream>
#include<conio.h>
using namespace std;
class rotation{
private:
@rsmahmud
rsmahmud / friend_function.cpp
Created January 27, 2017 13:24
Friend Function Concept in C++
/*
* Create 3 classes which takes the data for 3 semesters containing info of subject and marks
* Calculate the % for all semester
* finally calculate CGPA with a function program
*/
#include<iostream>
#include<conio.h>
using namespace std;
@rsmahmud
rsmahmud / file_compare.cpp
Created March 17, 2017 20:11
Compare two text file in C++
#include<iostream>
#include<fstream>
#include<conio.h>
using namespace std;
int main(){
fstream f1, f2;
char name[20], c1, c2;
int flag=3;
@rsmahmud
rsmahmud / getch.c
Created March 17, 2017 20:15
getch() function from conio.h library implementation on Windows
#include <windows.h>
TCHAR getch(){
DWORD mode, cc;
HANDLE h = GetStdHandle( STD_INPUT_HANDLE );
if (h == NULL)
return 0; // console not found
GetConsoleMode( h, &mode );
SetConsoleMode( h, mode & ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT) );
TCHAR c = 0;
ReadConsole( h, &c, 1, &cc, NULL );