Skip to content

Instantly share code, notes, and snippets.

View madcoder2k17's full-sized avatar

Joy madcoder2k17

View GitHub Profile
@madcoder2k17
madcoder2k17 / minesweeper.c
Last active July 3, 2017 10:25
Just practicing. I was trying to make a console version of Minesweeper.
/*********************************************************************************
Console-based version of Minesweeper 1.01
Copyright (C) <2012> <jAs MLt. Ltd.>
Email: junayedsunny8@gmail.com
To-do list:
1. Create a function where user can select levels {easy, medium, hard}
@madcoder2k17
madcoder2k17 / minesweepersecondedition.c
Last active July 3, 2017 10:24
I'm no longer checking for boundary conditions, so the "findnearbymines()" function is MUCH cleaner. But, there's still some work to be done, because it's not flushing out all the spaces without mines near the space selected by the user.. In other words, if a space is set to '0' meaning there's no nearby mines, it should check the spaces around …
/*********************************************************************************
Console-based version of Minesweeper 2.0.1
Copyright (C) <2012> <jAs MLt. Ltd.>
Email: junayedsunny8@gmail.com
To-do list:
1. Create a function where user can select levels {easy, medium, hard}
OTHER NOTES:
@madcoder2k17
madcoder2k17 / solitaire.c
Created July 3, 2017 07:12
It is unready c code for solitaire game. This the only thing i can make, the others, i going crazy!! i need to creat Deck, giving cards, make the moves, the table and the points
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <conio.c>
main()
{
int random(int x)
{
@madcoder2k17
madcoder2k17 / palindrome.h
Last active July 3, 2017 08:04
A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction. This program will prompt the user to enter a word or a sentence and then confirms if the user's entry is an palindrome or not.
/*
A palindrome is a word, phrase, number, or other sequence of symbols or elements,
whose meaning may be interpreted the same way in either forward or reverse direction.
This program will prompt the user to enter a word or a sentence and then confirms if
the user's entry is an palindrome or not.
*/
#include <iostream>
#include <cstdlib>
bool isPalindrome( char [] );
@madcoder2k17
madcoder2k17 / tictactoe.c
Created July 3, 2017 09:17
It is a compiler version game. The game is tictactoe™
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include <windows.h>
int board[10] = {2,2,2,2,2,2,2,2,2,2};
int turn = 1,flag = 0;
int player,comp;
void menu();
@madcoder2k17
madcoder2k17 / calendargenerator.c
Created July 3, 2017 09:25
This snippet submitted by Tyler Veness. Rearranged by ©jAs and contributed by jAs MLt. Ltd.™
#include <iostream>
#include <iomanip>
bool isLeapYear( unsigned int& ); //checks if 'year' is leap year
unsigned int firstDayOfJanuary( unsigned int& year );
unsigned int numOfDaysInMonth( unsigned int , unsigned int& ); // takes the number of the month, and 'year' as arguments
void printHeader( unsigned int ); //takes the number of the month, and the first day, prints, and updates
void printMonth( unsigned int , unsigned int& ); //takes number of days in month, and reference to 'firstDayInCurrentMonth' so it updates after every call
void skip( unsigned int ); //prints the specified amount of spaces
@madcoder2k17
madcoder2k17 / create-refile-wider-code.c
Last active July 3, 2017 09:56
This snippet submitted by jAs™ and copyright ©jAs MLt. Ltd.
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
char* program_name;
void system_error(char* cause, int exit_code)
@madcoder2k17
madcoder2k17 / int2binary.h
Created July 3, 2017 09:55
It is a snippet of integer to binary.
void display_binary_n(int dec)
{
const int size = sizeof(int) * 8 ;
unsigned int current;
int i;
for( i = size - 1 ; i >= 0 ; i--)
{
current = 1<<i;
printf("%d",( (current & dec) != 0) ? 1: 0);
}
@madcoder2k17
madcoder2k17 / segm01.c
Created November 20, 2017 16:22
Codechef : Bear and segment 1 : https://www.codechef.com/problems/SEGM01
#include<string.h>
#include<stdio.h>
int main()
{
char s[100000];
int n,count=0,i,T,o=0,c=0;
scanf("%d",&T);
while(T--)
{
c = 0, o = 0, count=0;