Sunday, September 13, 2015

Typing practice with bubble game

Many of us played this game in typing tutor. Bubbles are falling from the top containing a  character in it. We need to type that character to make that bubble disappear.
Same is here but there is no termination condition or scoring.
To terminate the code press ESC key.

Preview:

MS Paint like program in C

MS Paint Editor in C. It is having four function Circle, Rectangle, Line and Pen. Using this four function you can design whatever you want. And later you can save it by taking screenshot of it.

Preview:

Graphic program to design a moving car

Car looks like :

Happy Birthday sound in C

Graphic program to design calculator

In this program I used C graphics.
Not a big task, Only we need to know how to initialize Graphics then we can use inbuilt functions to design anything.
initgraph() is the function used to initialize graphics available in graphics.h library. It takes three parameter first one is reference to graphic driver, second one is reference to graphic mode and the last one is BGI library path.
Other functions I used are rectangle() to draw input box and buttons, line() for design, setcolor() to give color to shapes and outtextxy() to display text at specific x and y coordinates.

It looks like this :

Program to make arithmetic operations on complex numbers

Program to make arithmetic operation on rational numbers

Program to create a file in a C

Program to convert upper case to lower case using strlwr

Program to convert lower case to upper case using strupr

Program to convert upper case to lower case

Program to convert lower case to upper case

Program to concatenate string

Program to reverse a string

Program to count number of vowels in a string

Program to check leap year

Program to reverse a number

Program to check palindrome number

Program to find length of string without using predefined functions

Program to check difference between prefix & postfix

Program to find repeated characters in a string

Program to sort string

Program to use string array

Program to read file in a program

File reading:
It requires understanding of two functions fopen and fgetc

fopen():
This function takes two parameters first one is file path and second one is file opening mode. there are six file modes in C language, those are r,w,a,r+,w+ and a+. Here we are using r for reading file.
fopen() returns a FILE pointer.

fgetc():
This function reads and returns one character at a time and moves pointer to the next character.

Program to check unit matrix

Program to print unit matrix

Program to print transpose matrix

Program to multiply two matrix

Program to multiply a matrix with constant

Program to subtract to matrix

Program to add two matrix

Program to print matrix

Program to print directory path

If we want to print path like C:\TC\BIN to our console,  what we will do, we will put this string in printf like this

printf("C:\TC\BIN");

But the output will not be same as expected. Because there are some special symbols in the string those are making trouble for us. So we need to place extra backslash (\) to ignore those special symbols.

so the statement printf("C:\\TC\\BIN") will output as we want.

Powered by Blogger.