Wednesday, June 2, 2010
Tuesday, May 18, 2010
Oil Price Increasing... I have solution for this.
So Bajaj Auto launched another fuel saver bike.....
After The SUCCESS of .........
CT100............
COWasaki By BAJAJ
Sunday, May 16, 2010
How to implement List Data Structure in C Using Array.
If you are going to use this program on Windows then Delete all occurrences of \33[x where x may be 31,32,32.....,37. They have been used to produce colorful text.This program has be developed and tested on gcc.
First time it will ask the user to fill the list.
After that a menu will appear which will contain the following functions
1.View your list.
2.Add element at any position in the list.
3.Delete element(s) taking the value or the location.
4.Finding the location of the element(s) or element if location is provided.
5.Exit
#include<stdio.h>
int element,maxArraySize=65536;
int arr[65536];
int currentSizeOfArray=0;
//////Function Declarition//////
void printList(int x);//////*****************//////////
void addInput();
void addElement(int addPosition,int addItem);
void deleteInput();
void findItem();
void findByLocation(int location);
int findLocation(int item);
void findByValue(int elemn);
void deleteByLocation(int location);
void addList();
//////Main Finction/////////////
int main()
{
int userOption;
int ch;
printf("\33[36mWelcome to the list Software.\n"); ///\33[36m has been used to Make text colorful.It will work in linux only
printf("The list is empty please enter some values in the list.\n");
addList();
printList(currentSizeOfArray);
do
{
printf("\33[32mWhat operation you want to perform:\nPlease Choose Your option.\n");
printf("\noption\tExplanation\n");
printf("1\tView your list\n2\tAdd an element\n3\tDelete an element\n4\tFind the position of an element\n5\tExit\n");
scanf("%d",&userOption);
switch(userOption)
{
case 1:
printList(currentSizeOfArray);
break;
case 2:
printf("\33[35mPlease enter the location and Item to be added\n");
addInput();
printList(currentSizeOfArray);
break;
case 3:
printf("\n\33[35mPlease enter the position or item to be deleted\n");
deleteInput();
printList(currentSizeOfArray);
break;
case 4:
printf("\n\33[35mEnter the position or value you are willing to find\n");
findItem();
break;
case 5:
printf("\n\33[37mThanks for using this application\n\n");
return 0;
default :
printf("\n\33[31mYou entered an in valid choise\n");
}
printf("\n\33[37mWant to do some more thing on list, press 1 to continue\n");
scanf("%d",&ch);
} while(ch==1);
printf("\n\n\n");
}
void addList()
{
printf("Enter each number and then press enter. When all your elements get inserted.please enter 9876 to go to the Main Menu\n");
int i=0;
int j=maxArraySize;
for(i=0;i<j;i++)
{
scanf("%d",&arr[i]);
if(arr[i]==9876)
{
arr[i]=0;
break;
}
currentSizeOfArray++;
}
}
void printList(int x)
{
int i;
printf("\33[32mYour list is looking like this:\n\nLocation\tValue\n");
for( i=0;i<x;i++)
{
printf("%d \t\t %d \n",i,arr[i]);
}
}
void addInput()
{
int addPosition,addItem;
printf("\33[33m\nEnter the location\n");
scanf("%d",&addPosition);
if(addPosition>(currentSizeOfArray))
{
printf("\nYou can not enter at that location\n");
return;
}
printf("\nEnter the element\n");
scanf("%d",&addItem);
addElement(addPosition,addItem);
}
void addElement(int addPosition,int addItem)
{
currentSizeOfArray++;
int i,settle=currentSizeOfArray;
for(i=currentSizeOfArray;i>addPosition;i--)
{
arr[i]=arr[--settle];
}
arr[addPosition]=addItem;
}
void deleteInput()
{
int choise;
int loca,z=1;
printf("\n\33[34mPlease specify the option wheather you want to delete by Location or by Item Value\n");
printf("\noption\tExplanation\n1\tDelete by Location\n2\tDelete By value\n");
scanf("%d",&choise);
switch(choise)
{
case 1:
{
printf("Enter the location\n");
scanf("%d",&loca);
deleteByLocation(loca);
break;
}
case 2:
{
printf("\nEnter the element/value to be deleted\n");
scanf("%d",&element);
do
{
loca=findLocation(element);
if(loca==-1)
{
if(z==1)
{
printf("\33[31mThe element is not found\n");
}
break;
}
deleteByLocation(loca);
}while(1);
}
}
}
void findItem()
{
int choise,z=1;
int location;
printf("\n\33[35mPlease specify the option wheather you want to find the element by Location or by Item/element Value\n");
printf("\noption\tExplanation\n1\tFind by Location\n2\tFind By value\n");
scanf("%d",&choise);
switch (choise)
{
case 1:
printf("Enter the location\n");
scanf("%d",&location);
findByLocation(location);
break;
case 2:
printf("Enter the element\n");
scanf("%d",&element);
location=findLocation(element);
if(location==-1)
{
printf("\n\33[31mThe element is not found\n");
break;
}
findByValue(element);
break;
default :
printf("\n\33[31mYou have not chossen the correct option\n");
break;
}
}
void findByLocation(int location)
{
int i;
if(location>=currentSizeOfArray ||location<0)
{
printf("\n\33[31mThe element is not found,please checj the element or its location\n");
return;
}
for(i=0;i<currentSizeOfArray;i++)
{
if(i==location)
{
printf("\33[32msearch Sucessful,Itme %d found at %d\n",arr[i],i);
break;
}
}
}
int findLocation(int item)
{
int i;
for (i=0;i<currentSizeOfArray;i++)
{
if(item==arr[i])
return i;
}
return -1;
}
void findByValue(int elemn)
{
int i=1;
for (i=0;i<currentSizeOfArray;i++)
{
if(elemn==arr[i])
printf("\33[32mSearch Sucessful,Itme %d found at %d\n",arr[i],i);
}
}
void deleteByLocation(int location)
{
int i;
if(location>=currentSizeOfArray)
{
printf("\33[31mThe element is not found,please check the element or its location\n");
return;
}
for(i=location;i<currentSizeOfArray;i++)
{
arr[i]=arr[++location];
}
--currentSizeOfArray;
}
Wednesday, May 12, 2010
How to find number of days and difference between to dates using C
int count=-1,nofdays=-1,nofmonths=-1,nofyears=-1,lastmonthmaxday;
int main()
{
printf("This program will ask for two date values in the formate of DD-MM-YYYY and produces the number of days between the two dates also if those dates are your birth date and some later date then it will display your age till the later date.This will not validate for any wrong entry for days(like more than 30-31) and months(like more than 12).However if you enter,you will get some unexpected result. If you need, with a few changes and little affords you can achieve your requirements.\n");
int day1,day2,month1,month2,year1,year2,day11,month11,year11,year,month,day,maxdays,flag=0;
static int z=1;
printf("Enter the privous date (DD) \n");
scanf("%d",&day1);
printf("Enter the privous month (MM) \n");
scanf("%d",&month1);
printf("Enter the privous year,for not being ambiguous input plz enter in YYYY format,else it will be a y2k bug\n");
scanf("%d",&year1);
printf("Enter the later date (DD)\n");
scanf("%d",&day2);
printf("Enter the later month (DD)\n");
scanf("%d",&month2);
printf("Enter the later year,for not being ambiguous input plz enter in YYYY format,else it will be a y2k bug\n");
scanf("%d",&year2);
day11=day1;month11=month1;year11=year1;lastmonthmaxday=checkmonth(month2-1,year2);
for(year=year11;year<=year2;year++) { for(month=month11;month<=12;month++) { if(year==year2 && month==month2) { flag=0;lastmonthmaxday=day2;countday(day11,day2,flag); break; } else { maxdays=checkmonth(month,year); countday(day11,maxdays,flag);flag=1;day11=1; } } month11=1; nofyears++; } if(month2<=month1 && nofyears !=0) { --nofyears; } if((day2<=day1 && nofmonths !=0) || nofmonths==12 ) { if(nofmonths==12){ nofyears++; nofmonths=0; } else --nofmonths; } maxdays=checkmonth(month2-1,year2); if(nofdays>=maxdays)
nofdays=nofdays-maxdays;
printf("The total number of days are : %d \nYou are %d year %d months %d days older\n",count,nofyears,nofmonths,nofdays);
return 0;
}
//This function will start from the previous date and keep on counting each day as long as it come to the later date.
void countday(int ddin, int ddfnl,int flg)
{
int i,day1,day2=35;
static int x=1,y=1;
for(i=ddin;i<=ddfnl;i++) { count++; if(flg==0 && i<=lastmonthmaxday) { if(lastmonthmaxday>ddfnl && x==1)
{
nofdays=nofdays+(lastmonthmaxday-ddfnl);
x++;
}
nofdays++;
if(y==1)
day1=ddin;
else if(y==2)
day2=ddfnl;
y++;
if(day1>day2)
{
break;
}
}
}
nofmonths++;
if(nofmonths==13)
nofmonths=1;
}
int checkmonth(int month,int year)
{
if(month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12 || month==0) //These are the months having 31 days
return 31;
else if(month==4 || month==6 || month==9 || month==11) //These are the months having 30 days
return 30;
else if(month==2) //This is for february only
{
if((year%400==0) || (year%4==0 && year%100!=0)) //This is for checking a leap year
return 29;
else
return 28;
}
}
Sunday, May 9, 2010
How Peter Answers Virtual Tarot works?
Actually Peter (1957-1979) was a software Engineer fully devoted and addicted of computers and programming. One day he designed a software application which can directly connect to his brain and his soul. The software can tell each and every thing what was there in his mind. What ever he thought, the software could tell. He finally decided to donate this software to

Was the story good? So can I tell you the truth now? Ok!! There is a trick. In the petition box what ever you write, will come as an output. Amazed again!! You have to follow these simple steps. Call a friend and tell Mr. Peter’s story first. Then tell him to ask a question to Mr. Peter politely. The answer to that question must be known to you. Step 1: Click in the Petition box (now the cursor is blinking in the box). Step 2: Press dot (.) as the first key, as soon as you press (.) at the same time ‘P’ will appear in the box automatically(in Petition Box). Step 3: Now write the answer to the question for your friend. As you write the answer, the box will automatically show “Peter, please answer the following question” irrespective of what you type (What you type here will come as an output so write correctly). If the answer is small you can press space bar to complete the sentence (“Peter, please answer:”). Step 4: Press enter. The cursor will now be blinking in the Question box. Step 5: Write your friends question and press enter. If this is you first time then a message box will come to accept the terms. Press ok and fool your friends. Ok. Enjoy.






