Tuesday, November 1, 2011

Convert decimail to roman

//Convert decimail nos to roman equivalent upto 10,000

/*
                     Roman      Decimal
                     1                  i
                     5                  v
                     10                x
                     50                l
                     100              c
                     500             d
                     1000           m                 */


#include<stdio.h>
#include<conio.h>
void thousand(int i) //Function for generating roman equivalent of 1000's
{
                int x;
                for(x=1;x<=i;x++)
                printf("m");
}
void hundred(int x) //Function for generating roman eq of 100's

Telephone Directory

/* PROGRAM TO IMPLEMENT A PHONE RECORD DATABASE USING LINKED LIST
AND FILE HANDLING USING FORMATTED I/O FUNCTIONS fscanf() and
fprintf()
*/

# include <conio.h>
# include <stdio.h>
# include <alloc.h>
# include <string.h>

struct node
{
int num;
char name[15];
struct node *next;
};

Guessing Game in C

//Guessing Game in C

#include <stdio.h>

int main()

{
         int mybday = 20; //declare variable to be guessed
         int guess;    //declare variable to store guessed date
         int max = 31;     //declare variable to test for invalid input
         int min = 1;   //declare variable to test for invalid input
            clrscr();
         printf("Try to guess the day of my Birthday: "); //display the intro and directions
          scanf("%d",&guess);   //`get the users guess and store it in the variable guess

         if (guess == mybday)
                 {
                 printf("You Win!!");    //print you win if guess is correct
         }
         else if (guess < min)
                 {
                 printf("Thats NOT A DATE!!"); //print `Error for invalid input
         }
         else if (guess > max)
     {
                 printf("There isn't %d days in a month!",guess);  //print Error for invalid input
         }
         else if (guess > mybday)
         {
                 printf("Too High!");  //print too high if guess is above answer
         }
         else if (guess < mybday)
                 {
                 printf("Too Low!"); //print too low if guess is below answer
         }
                 else
         {
                 printf("Try again!!");    //Print try again if guess if all else is not true (not possible)
         }

         return 0;
}

Analog Clock Program

//Analog Clock Program
//code will work on windows xp / dos box /not in win7

#include<graphics.h>
#include<conio.h>
#include<math.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm;
int x=320,y=240,r=200,i,h,m,s,thetamin,thetasec;
struct  time t;
char n[12][3]={"3","2","1","12","11","10","9","8","7","6","5","4"};
initgraph(&gd,&gm,"f:\arun\tc");

Program for Decimal to Roman Number conversion

//Program for Decimal to Roman Number conversion

#include<stdio.h>

main()
{
int a,b,c,d,e;
clrscr();
printf("Input a  number (between 1-3000):");
scanf("%d",&e);
while (e==0||e>3000)

program for mobile billing management

# include <conio.h>
# include <stdio.h>
# include <alloc.h>
# include <string.h>

struct node
{
int num;
char name[15];
struct node *next;
};