Blogger news

Followers

Showing posts with label downloadable. Show all posts
Showing posts with label downloadable. Show all posts
Wednesday, September 25, 2013
 #include<iostream.h>
 #include<fstream.h>
 #include<conio.h>

 void main()
  {

   clrscr();
   int i;
   ofstream outf("SACHIN TENDULKAR");
   cout<<"enter the value"<<endl;
   cin>>i;
   outf<<i;
   outf.close();

   ifstream inf("SACHIN TENDULKAR");
   inf>>i;
   cout<<i;

   inf.close();

   getch();

   }

Design,develop and execute the c++ program according to the below instructions:
  An employee class is to contain following datamembers and memer functions:
data member:
   empolyee_number
   employee_name
   basic_salary
   all_alavances
    it(income tax)
    net_salary
member functions:
   to read data of an emplyee
   to calculate salary
   to print value of all data memebers
hints:
all_alavances=120% of basic salary
it=30% of gross salary
net salary=basic salary+all_alavances-income tax
gross salary=basic salary+all_alavances



---------
 #include<iostream.h>
 #include<conio.h>
 #define MAX 2
 class employee
 {
   int employee_number;
   char employee_name[15];
   int basic_salary;
   int all_alavances;
   int it;
   int net_salary;

   public:

       void read()
       {
     cout<<"enter the employee number"<<endl;
     cin>>employee_number;
     cout<<"enter the employee name"<<endl;
     cin>>employee_name;
     cout<<"enter the basic salary"<<endl;
     cin>>basic_salary;
     }
     void calc()
     {
       int gross;
       all_alavances=(basic_salary*120)/100;
       gross=basic_salary+all_alavances;
       it=(gross*30)/100;
       net_salary=gross-it;
       cout<<"calaculated"<<endl;
     }
     void print()
     {
      cout<<employee_number<<"\t"<<employee_name<<"\t"<<basic_salary<<"\t"<<all_alavances<<"\t"<<it<<"\t"<<net_salary<<endl;
     }
 };

 void main()
 {
   int i;
   employee a[MAX];

   clrscr();

   for(i=0;i<MAX;i++)
   {
     a[i].read();
     a[i].calc();

   }

   cout<<"employee number|empolyee name|basic salary|all alavances|income tax"<<"\t"<<"net_salary"<<endl;
   for(i=0;i<MAX;i++)
   {
    a[i].print();
   }
getch();
}






Sunday, September 15, 2013


Design,develop and execute a program in C to execute a validpostfix expression using stack. Assume that the postfix expression isread as a single line consisting of non-negative single digit operandsand binary arithematic operators.The arithematic operators are +(add),-(subtract),*(multiply) and /(add).


CLICK HERE TO DOWNLOAD PROGRAM FILE NOW!

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void infix_postfix(char[],char[]);
char s[30];
int top=-1;
void push(char elem)
{
 s[++top]=elem;
 }
 char pop()
 {
 return(s[top--]);
 }

void main()
{
char infix[20];
char postfix[20];
clrscr();
printf("Enter a valid infix expression\n");
gets(infix);
infix_postfix(infix, postfix);
printf("The postfix expression is\n");
puts(postfix);
getch();
}

void infix_postfix(char infix[],char postfix[])
{

 int j;
 int i;

 char symbol,x;

 push('#');
 j=0;
 for(i=0;i<strlen(infix);i++)
 {

  symbol=infix[i];
  switch(symbol)
  {
   case'(':
  push(symbol);
   break;
   case ')':

    while(s[top]!='(')
    {
    postfix[j++]=pop();
    }
    x=pop();
    break;
   case'/':
   case'*':
   case'+':
   case'-': while(isp(s[top])>=icp(symbol))
   {
     postfix[j]=pop();
     j++;
    }
   push(symbol);
    break;


   default:
   postfix[j++]=symbol;
   break;
   }
   }
   while(s[top]!='#')
   {
    postfix[j++]=pop();
    }

   postfix[j]='\0';
   }

int isp(char symbol)
{
switch(symbol)
{
case '/':
case '*':return (3);
case '+':
case '-':return (2);
case ')':
case '(':return (1);


case '#':return (-1);
default :return (0);
}
}
int icp(char symbol)
{
switch(symbol)
{
case'/':
case'*':return (3);
case'+':
case'-':return (2);
case'#':return (-1);
default:return (0);
}
}

 ------

/*Program Ends*/


CLICK HERE TO DOWNLOAD PROGRAM FILE NOW!
Thursday, August 29, 2013
Design,develop and execute a program in C to stimulate the working of queue of integers using an array.Provide the following operations:
1.Insert    2.Delete   3.Display 
CLICK HERE TO DOWNLOAD PROGRAM FILE

#include<stdio.h>
#include<conio.h>
#define MAX_SIZE 5
int front=-1,rear=-1,a,c,i,x,element;
int queue[MAX_SIZE];
void enqueue();
void dequeue();
void display();
void main()
{
clrscr();
while(1)
{
printf("\n++++MENU++++\n");
printf("============\n");
printf("1 for enqueue\n2 for dequeue\n3 for display");
printf("\n4 for exit\n");
printf("enter your choice:");
scanf("%d",&a);
switch(a)
{
case 1:
enqueue();
break;
case 2:
dequeue();
break;
case 3:
display();
break;
case 4:
exit(0);
break;
default:
printf("invalid..!");
break;
}
getch();

}
}



void enqueue()
{
if(rear==MAX_SIZE-1)
{
printf("queue full..!\n");
}
else
{
printf("enter a number:");
scanf("%d",&element);
rear++;
queue[rear]=element;
}
}



void dequeue()
{
if(front==rear)
{
printf("queue empty..!");
}
else
{
front++;
x=queue[front];
printf("deleted element is %d",x);
}
}


void display()
{
if(front==rear)
{
printf("queue empty..!");
}
else
printf("\nentered number:");
{
for(i=front+1;i<=rear;i++)
{
printf("%d",queue[i]);
}
}
}
______________________________
//program ends
CLICK HERE TO DOWNLOAD PROGRAM FILE
screen shots:







Tuesday, August 27, 2013
Design,develop and execute a program in C to input N integer numbers into a single dimensional array,sort them in ascending order using dimensional array and perform a binary search for a given key integer number and report success or failure in the form of suitable message

CLICK HERE TO DOWNLOAD PROGRAM FILE!

 Program No:3
=================
 #include<stdio.h>
 #include<conio.h>
 #include<process.h>

 void main()
  {
    int a[100],i,n,key,first,last,mid;
    clrscr();
    printf("enter the limit number of array elements\n");
    scanf("%d",&n);

    printf("enter the elements of array\n");

    for(i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
    }

    printf("My array elements...\n");

    for(i=0;i<n;i++)
    {
      printf("%d \n",a[i]);
    }

    printf("enter your searching word\n");
    scanf("%d",&key);

    first=0;
    last=n-1;

    while(first<=last)
    {
      mid=(first+last)/2;

      if(key==a[mid])
      {
    printf("\n %d is found at location =%d\n",key,mid+1);
    getch();
    exit(0);
      }
     else
     {
      if(key>a[mid])
      {
    first=mid+1;
      }
      else
      {
       last=mid-1;
      }

    }
   }
    printf("The %d is not found in the list ",key);

    getch();
  }

===================
Program Ends

CLICK HERE TO DOWNLOAD PROGRAM FILE!

To referance wikipedia link

screenshots: