Posts

Program For Printing Digits In Larger Size

Image
In this program it will receive  numbers in digits and print in larger format as shown here: #include<stdio.h> #include<conio.h>  void main()  { int k,j,i,s,n=8; int arr[5]; clrscr(); printf("Enter the lenth of the number"); scanf("%d",&s); printf("Enter the number to print it in large format"); for(i=0;i<s;i++) { scanf("%d",&arr[i]); } for(i=0;i<8;i++) { for(k=0;k<9;k++) { if(arr[k]==0)       { if(i==0||i==n-1) printf(" ""###"" "); else printf("#"" "" "" ""#"); printf(" "); } if(arr[k]==1) { if(i==1) printf("##"); else    if(i==n-1) { printf("###"); } else    printf(" ""#"); printf(" "); } if(arr[k]==2) { if(i==0||i==4||i==7) printf("#####"); else if(i==5||i...

Solving Puzzle In C

Image
This program is for solving  puzzle using a c program : In this there are 15 numbered square pieces mounted on a frame. these pieces can be moved horizontally or vertically.a possible arrangement of these pieces is shown below:  here the last block is empty . #include<stdio.h> #include<conio.h> #include<graphics.h> void main() { int a[4][4]={1,4,15,7,8,10,2,11,14,3,6,13,12,9,5};             int ch,i,j,n=0,k,l; i=3; j=3; clrscr(); for(k=0;k<4;k++) { for(l=0;l<4;l++) {       printf("\t"); textcolor(4+BLINK);          /*here the number in textcolor (4)specifies the  red  color                                                                           i...

Heap Sort Without using Recursion

#include<stdio.h> #include<stdlib.h> #include<conio.h> void makeheap(int a[],int *); int heapsort(int a[],int *); void main() { int a[8]={23,55,46,35,10,90,84,31},b[8],t=7,i=0; clrscr(); printf("before sorting\n"); makeheap(a,&t); for(i=0;i<=t;i++) { printf("%d\t",a[i]); } printf("\nafter sorting\n"); for(i=0;i<=7;i++) { b[i]=heapsort(a,&t); t--; makeheap(a,&t); } for(i=0;i<=7;i++) { printf("%d\t",b[i]); } getch(); } void makeheap(int a[],int *m) { int i=0,j,k,t; int l; l=(*m)/2 ; for(j=0;j<l;j++) { for(k=0;k<2;i++,k++) { if(a[j]<a[i+1]) { t=a[j]; a[j]=a[i+1]; a[i+1]=t; } if(a[0]<a[j]) { t=a[j]; a[j]=a[0]; a[0]=t; } } } } int  heapsort(int a[],int *p) { int t=0; t=a[*p]; a[*p]=a[0]; a[0]=t; return(a[*p]); }

Phases of storing and handling data

Image
Phases of storing and handling data This post is all about the different way of storing the data .data is the most important part of any organization and today the whole IT industry is working for this. most of the times we are spending our time in storing updating and accessing this data. So here the step by step ways of handling data is given. In the beginning of time we are using arrays as a means of storage of data but because of its limitations we switch on to the next concept but it has also some limitations so we move on to the next concept which is queues and then  linked lists.         Arrays Stack         Queues Linked list        Array        Stack Queu Link list Concept: an array is a data structure used to process multiple elements with the same data type when a number of such elements are...

sample program for handling dabase of a bank using class

here the program is just to give an overview of  a bank  database using class.object oriented programing is used to handle large database and when we have data in mass then we need to securly handle it . when we are talking about data then the first thing about which we are concerned is it's security and c++ provide this facility so this program is giving an overview that how database can be handled using c++ . #include<iostream.h>                                               //including header file #include<conio.h> class bank                                                                    // defining class { int ac_name,w;              ...

Student Help: How to add a user defined function to a library fu...

Student Help: How to add a user defined function to a library fu... : Here we are going to create a function for factorial of a the given number: Step 1: First create the definition of the program and...

how to create our own header files

Hello friends I am here with my post which is how to create your own header files but before start I would like to explain what a header file is and why it is used in our program. We all know that a program contain different library functions to perform the given job by user. A header file contains the definition of the functions which is included in that header file. Definition of a function tells the compiler that what operation that function have to perform or in what manner and how many number of argument it accept and how many argument it will return .the type of arguments everything about that function. There are number of header files used in c programming we just have to call as per as our requirement .header files are very useful so let’s make a header file of our own. Follow these steps: First of all create the definition of a function and save it with the extension .h (my_func.h) Example: int sum(int a,int b) { return(a+b); } ·     ...