Tuesday, 31 July 2018

Forming Quadratic equation

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();
    int x1,x2,sum,prod;
    cout<<"\nFormng of equation from Roots:- \n Enter first Root of the equation: ";
    cin>>x1;
    cout<<"\n Enter second Root of the equation: ";
    cin>>x2;
    sum=x1+x2;
    prod=x1*x2;
    if(sum>=0)
    {   if(prod>=0)
cout<<"\n\nThe equation is: xý-"<<sum<<"x+"<<prod;
else
cout<<"\n\nThe equation is: xý-"<<sum<<"x"<<prod;
    }
    else
    {   if(prod>=0)
cout<<"\n\nThe equation is: xý"<<sum<<"x+"<<prod;
else
cout<<"\n\nThe equation is: xý"<<sum<<"x"<<prod;
    }
    getch();
}



===========================================================================


                                OUTPUT


Details of a Four Digit Number

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>

void main()
{
   clrscr();
   int n,a,b,c,d,s,r;
   cout<<"\n Enter a Four Digit number: ";
   cin>>n;
   a=n%10;
   n=n/10;
   b=n%10;
   n=n/10;
   c=n%10;
   n=n/10;
   d=n%10;
   s=a+b+c+d;
   r=1000.0*a+100.0*b+10.0*c+1.0*d;
   cout<<"\n\n    The Sum of the digits of the number is: "<<s;
   cout<<"\n\n    The Reverse of the number is: "<<r;
   cout<<"\n\n    The number in Expanded form is:- ";
   cout<<"\n      ¯ Thousand Place: "<<a;
   cout<<"\n      ¯ Hundered Place: "<<b;
   cout<<"\n      ¯ Tens Place: "<<c;
   cout<<"\n      ¯ Ones Place: "<<d;
   getch();
}



===========================================================================


                                OUTPUT


Merchant's Bill

===========================================================================
                                CODING


#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();
    char a[5],b[5],c[5];
    int na,nb,nc,pa,pb,pc,t,tt,gst;
    cout<<"\nBilling Counter:- \n Enter name of first product: ";
    cin>>a;
    cout<<"\n   ¯Enter price: ";
    cin>>pa;
    cout<<"\n   ¯Enter number of units: ";
    cin>>na;
    cout<<"\n Enter name of second product: ";
    cin>>b;
    cout<<"\n   ¯Enter price: ";
    cin>>pb;
    cout<<"\n   ¯Enter number of units: ";
    cin>>nb;
    cout<<"\n Enter name of third product: ";
    cin>>c;
    cout<<"\n   ¯Enter price: ";
    cin>>pc;
    cout<<"\n   ¯Enter number of units: ";
    cin>>nc;
    pa=pa*na;
    pb=pb*nb;
    pc=pc*nc;
    t=pa+pb+pc;
    gst=0.05*t;
    tt=t+gst;
    cout<<"\n------------------------------------";
    cout<<"\n| S.NO. | Item Name | Qty. | Price |";
    cout<<"\n|   1   | "<<a<<"      | "<<na<<"    | "<<pa<<"    |";
    cout<<"\n|   2   | "<<b<<"      | "<<nb<<"    | "<<pb<<"    |";
    cout<<"\n|   3   | "<<c<<"      | "<<nc<<"    | "<<pc<<"    |";
    cout<<"\n|----------------------------------|";
    cout<<"\n|          Total: "<<t<<"              |";
    cout<<"\n|----------------------------------|";
    cout<<"\n|          GST: "<<gst<<"                  |";
    cout<<"\n|----------------------------------|";
    cout<<"\n|          Bill: "<<tt<<"               |";
    cout<<"\n|----------------------------------|";
    cout<<"\n|        Thanks For Visit!!        |";
    cout<<"\n------------------------------------";
    getch();
}



===========================================================================


                                OUTPUT


Tax Calculator

===========================================================================
                                CODING


#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>

void main()
{
clrscr();
float age,lic,aexpense,rebate80,rebate20,basicsalary,total,T,gst,p1,p2,p3;
char name[20];
cout<<"TAX Calculation:- \n Enter your Name: ";
gets(name);
cout<<"\n Enter Age: ";
cin>>age;
cout<<"\n Enter your LIC: ";
cin>>lic;
cout<<"\n Enter your Approx. Expense: ";
cin>>aexpense;
cout<<"\n Enter 80 CC rebate: ";
cin>>rebate80;
cout<<"\n Enter 20 CC rebate: ";
cin>>rebate20;
cout<<"\n Enter Basic Salary: ";
cin>>basicsalary;
total=basicsalary*12-lic-aexpense+0.2*rebate80+0.8*rebate20;
if(total>0 && total<=300000)
{
T=0;
gst=0;
}
else if(total>300000 && total<=500000)
{
p1=0.1*(total-300000);
gst=0.125*p1;
T=gst+p1;
}
else if(total>500000 && total<=1000000)
{
p1=0.1*(200000);
p2=0.2*(total-500000);
gst=0.125*(p1+p2);
T=p1+p2+gst;
}
else if(total>1000000)
{
p1=0.1*200000;
p2=0.2*500000;
p3=0.3*(total-1000000);
gst=0.125*(p1+p2+p3);
T=gst+p1+p2+p3;
}
cout<<"\n"<<name<<" You have to pay a total TAX of: "<<T<<" inclusive gst of: "<<gst;
getch();
}



===========================================================================


                                OUTPUT


Electricity Billing

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
int nac,ntube,nfan,ntv,n;
float TE,RS,E,ac,fan,tube,tv,p1=0,p2=0,p3=0;
char name[20];
cout<<"Electricity BILL:- \n Enter your Name: ";
cin>>name;
cout<<"\n  Enter Number of AC: ";
cin>>nac;
cout<<"\n        ¯Enter power of one AC(in Watt): ";
cin>>ac;
cout<<"\n  Enter Number of Tubelight: ";
cin>>ntube;
cout<<"\n        ¯Enter power of one Tubelight(in Watt): ";
cin>>tube;
cout<<"\n  Enter Number of Fan: ";
cin>>nfan;
cout<<"\n        ¯Enter power of one Fan(in Watt): ";
cin>>tube;
cout<<"\n  Enter Number of T.V.: ";
cin>>ntv;
cout<<"\n        ¯Enter power of one TV(in Watt): ";
cin>>tv;
cout<<"\n\nEnter number of days: ";
cin>>n;
E=(ac*nac+tube*ntube+fan*ntube)/1000.0;
TE=n*E;
if(TE>0 && TE<=200)
{
p1=2.80*TE;
}
else if(TE>200 && TE<=400)
{
p1=2.80*200;
p2=3.40*(TE-200);
}
else
{
p1=2.80*200;
p2=3.40*200;
p3=5*(TE-400);
}

cout<<"\n"<<name<<" You have to pay "<<p1+p2+p3;
getch();
}



===========================================================================


                                OUTPUT



Billing

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<stdio.h>

void main()
{
long n,q,m,price,note1,note2,nnote1,nnote2;
float tprice,cashback;
char pro[30],name[20],address[100],confirm;
clrscr();
cout<<"Billing:- \n Enter your Name: ";
cin>>name;
cout<<"\n Available products:- ";
cout<<"\n  [1] A.C.";
cout<<"\n  [2] Fridge";
cout<<"\n  [3] Washing Machine";
cout<<"\n  [4] T.V.";
cout<<"\n\n¯ Enter The Product Bought:- ";
cin>>q;
switch(q)
{
case 1:strcpy(pro,"AC");
price=40000;
note1=2000;
note2=500;
nnote1=20;
nnote2=0;
break;
case 2:strcpy(pro,"Fridge");
price=15000;
note1=2000;
nnote1=7;
note2=500;
nnote2=2;
break;
case 3:strcpy(pro,"Washing Machine");
price=20000;
note1=2000;
nnote1=10;
note2=500;
nnote2=0;
break;
case 4:strcpy(pro,"TV");
price=80000;
note1=2000;
nnote1=40;
note2=500;
nnote2=0;
break;
default: cout<<"Wrong Input!!";
}
cout<<"\n Enter Address: ";
gets(address);
cout<<"\n Available Mode of Payment:- ";
cout<<"\n  [1] Cheque";
cout<<"\n  [2] Cash";
cout<<"\n  [3] Credit EMI";
cout<<"\n  [4] Credit  No EMI";
cout<<"\n\n¯ Enter Mode of Payment:- ";
cin>>n;
switch(n)
{
case 1:
cout<<"\n Enter cheqe no.: ";
cin>>m;
tprice=0.18*price+price;
cout<<"\n"<<name<<" you have bought a "<<pro<<". \nYour Address is "<<address<<".\nThe Total amount to be paid= "<<tprice<<"Rs. (inluding GST) under cheque no.: "<<m;
cout<<"\nIF all the details are correct enter Y, if not enter N: ";
cin>>confirm;
if(confirm==89)
{cout<<"\nThank you for Shopping with us";
}
else if(confirm==78)
{cout<<"\nPlease Restart Programme";}
break;
case 2:
tprice=0.18*price+price;
cout<<"\n"<<name<<" you have bought a "<<pro<<". \nYour Address is "<<address<<".\nThe Total amount to be paid= "<<tprice<<"Rs. (inluding GST) in Cash";
cout<<"\nIF all the details are correct enter Y, if not enter N: ";
cin>>confirm;
if(confirm==89)
{cout<<"\nThank you for Shopping with us";
cout<<"\nThe payment is recieved in form of:- ";
cout<<"\n\tValue\tNumber of Notes";
cout<<"\n\t"<<note1<<"\t     "<<nnote1;
cout<<"\n\t"<<note2<<"\t     "<<nnote2;
}
else if(confirm==78)
{cout<<"\nPlease Restart Programme";}
break;
case 3:
tprice=0.12*price+0.18*price+price;
cout<<"\n"<<name<<" you have bought a "<<pro<<". \nYour Address is "<<address<<".\nThe Total amount to be paid= "<<tprice<<"Rs. (inluding GST[18%] and EMI[12%]) under Credit with EMI";
cout<<"\nIF all the details are correct enter Y, if not enter N: ";
cin>>confirm;
if(confirm==89)
{cout<<"\nThank you for Shopping with us";
}
else if(confirm==78)
{cout<<"\nPlease Restart Programme";}
break;
case 4:
tprice=0.12*price+0.18*price+price;
cout<<"\n"<<name<<" you have bought a "<<pro<<". \nYour Address is "<<address<<".\nThe Total amount to be paid= "<<tprice<<"Rs. (inluding GST) under Credit with no EMI";
cout<<"\nIF all the details are correct enter Y, if not enter N: ";
cin>>confirm;
if(confirm==89)
{cashback=0.05*price;
cout<<"\nYou will get a cashback of "<<cashback<<"Rs. within 24 hours. \nThank You For Shopping With Us";
}
else if(confirm==78)
{cout<<"\n Please Restart Programme";}
break;
default: cout<<"Wrong input!!!!";
}
getch();
}



===========================================================================


                                OUTPUT



Series Menu

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
int n,m;
float S;
clrscr();
cout<<"\nQ)What to find Sum:-";
cout<<"\n  1:- 1+2+3+....+n";
cout<<"\n  2:- 1ý+2ý+3ý+....+ný";
cout<<"\n  3:- (1+2+3+....+n)ý";
cout<<"\n\n¯What kind of Series do you select:- ";
cin>>m;
switch(m)
{
case 1:
cout<<"\n Enter last term(n): ";
cin>>n;
S=n*(n+1)/2.0;
cout<<"\n The sum of the Series is: "<<S;
break;
case 2:
cout<<"\n Enter last term(n): ";
cin>>n;
S=n*(n+1)*(2*n+1)/6.0;
cout<<"\n The sum of the Series is: "<<S;
break;
case 3:
cout<<"\n Enter last term(n): ";
cin>>n;
S=pow(n*(n+1)/2.0,2);
cout<<"\n The sum of the Series is: "<<S;
break;
default: cout<<"Wrong input!!!!";
}
getch();
}



===========================================================================


                                OUTPUT



S.I. / C.I. / E.M.I.

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
int n,P,R,T;
float SI,CI,EMI;
clrscr();
cout<<"\nQ)Want to Find:-";
cout<<"\n  Simple Interest[1]";
cout<<"\n  Compound Interest[2]";
cout<<"\n  Easy Monthly Instalment[3]";
cout<<"\n\n¯What do you want to find:- ";
cin>>n;
switch(n)
{
case 1:
cout<<"\n Enter Principal amount:- ";
cin>>P;
cout<<"\n Enter Rate of interest:- ";
cin>>R;
cout<<"\n Enter Time period:- ";
cin>>T;
SI=(P*R*T)/100.0;
cout<<"\nThe Simple Interest for "<<P<<"Rs. for "<<T<<" years at rate of interest "<<R<<"%p.a. is "<<SI;
break;
case 2:
cout<<"\n Enter Principal amount:- ";
cin>>P;
cout<<"\n Enter Rate of interest:- ";
cin>>R;
cout<<"\n Enter Time period:- ";
cin>>T;
CI=pow(P*(1+R/100),T);
cout<<"\nThe Compound Interest for "<<P<<"Rs. for "<<T<<" years at rate of interest "<<R<<"%p.a. is "<<CI;
break;
case 3:
cout<<"\n Enter P: ";
cin>>P;
cout<<"\n Enter CI: ";
cin>>CI;
cout<<"\n Enter Time: ";
cin>>T;
EMI=(P+CI)/T;
cout<<"\nThe Easy Monthly Instalment For "<<P<<"Rs. and "<<CI<<" compound interest for Time "<<T<<" years is: "<<EMI;
break;
default: cout<<"Wrong input!!!!";
}
getch();
}



===========================================================================


                                OUTPUT



Quadrant Detector

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
float x,y;
cout<<"¯Enter the  co-ordinates of point:- \n    Enter x co-ordinate: ";
cin>>x;
cout<<"\n    Enter y co-ordinate: ";
cin>>y;

if(x>0 && y>0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in First quadrant";}
else if(x<0 && y>0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in Second quadrant";}
else if(x<0 && y<0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in Third quadrant";}
else if(x>0 && y<0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is in Fourth quadrant";}
else if(x==0 && y==0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is At Origin";}
else if(x>0 && y==0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on X-Axis";}
else if(x<0 && y==0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on X'-Axis";}
else if(x==0 && y>0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on Y-Axis";}
else if(x==0 && y<0)
{
cout<<"\n The Point ("<<x<<", "<<y<<") is on Y'-Axis";}
getch();
}



===========================================================================


                                OUTPUT



Stream Calculator

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
float p,o,i,u,y,t;
char l[20],grade;
cout<<"Enter Your NAME: ";
cin>>l;
cout<<"\n Enter marks of Maths (out of 100) : ";
cin>>p;
cout<<"\n Enter marks of English (out of 100) : ";
cin>>o;
cout<<"\n Enter marks of Sanskrit (out of 100) : ";
cin>>i;
cout<<"\n Enter marks of Science (out of 100) : ";
cin>>u;
cout<<"\n Enter marks of Social Science (out of 100) : ";
cin>>y;
t=(p+o+i+u+y)/5;
if(t>0 && t<=30)
{grade='F';
cout<<"\n"<<l<<" sorry you are Fail!!!! go study";}
else if(t>30 && t<=60)
{grade='E';
cout<<"\n"<<l<<" your grade is \"E\" need to work hard";}
else if(t>60 && t<=70)
{grade='D';
cout<<"\n"<<l<<" your grade is \"D\" go home and get lost";}
else if(t>70 && t<=80)
{grade='C';
cout<<"\n"<<l<<" your grade is \"C\" go home and get lost";}
else if(t>80 && t<=90)
{grade='B';
cout<<"\n"<<l<<" your grade is \"B\" go home and get lost";}
else if(t>90 && t<=100)
{grade='A';
cout<<"\n"<<l<<" your grade is \"A!!\" ";}
else
{grade='G';
cout<<"\nWrong Input";}
switch(grade)
{
case 'A': cout<<"\n"<<l<<" you are eligible for Art"; break;
case 'B': cout<<"\n"<<l<<" you are eligible for Commerce"; break;
case 'C': cout<<"\n"<<l<<" you are eligible for Dance"; break;
case 'D': cout<<"\n"<<l<<" you are eligible for Majduri"; break;
case 'E': cout<<"\n"<<l<<" you are eligible for Kheti"; break;
case 'F': cout<<"\n"<<l<<" you are eligible for Nothing"; break;
default : cout<<"....";
}
getch();
}


===========================================================================


                                OUTPUT



Co-ordinate Area Menu

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
float a1,a2,b1,b2,c1,c2,d1,d2,Ar,Ar1,Ar2;
int n;
clrscr();
cout<<"\nQ)Want to find Area:-";
cout<<"\n  Triangle[1]";
cout<<"\n  Quadrilataral[2]";
cout<<"\n\n¯What type of fig. are you finding:-";
cin>>n;
switch(n)
{
case 1:
cout<<"\n\n¯Enter the  co-ordinates of point A:- \n    Enter x co-ordinate: ";
cin>>a1;
cout<<"\n    Enter y co-ordinate: ";
cin>>a2;
cout<<"\n\n¯Enter the  co-ordinates of point B:- \n    Enter x co-ordinate: ";
cin>>b1;
cout<<"\n    Enter y co-ordinate: ";
cin>>b2;
cout<<"\n\n¯Enter the  co-ordinates of point C:- \n    Enter x co-ordinate: ";
cin>>c1;
cout<<"\n    Enter y co-ordinate: ";
cin>>c2;
Ar=0.5*(a1*(b2-c2)+b1*(c2-a2)+c1*(a2-b2));
cout<<"\n\n  ¯Area= "<<fabs(Ar); break;
case 2:
cout<<"\n\n¯Enter the  co-ordinates of point A:- \n    Enter x co-ordinate: ";
cin>>a1;
cout<<"\n    Enter y co-ordinate: ";
cin>>a2;
cout<<"\n\n¯Enter the  co-ordinates of point B:- \n    Enter x co-ordinate: ";
cin>>b1;
cout<<"\n    Enter y co-ordinate: ";
cin>>b2;
cout<<"\n\n¯Enter the  co-ordinates of point C:- \n    Enter x co-ordinate: ";
cin>>c1;
cout<<"\n    Enter y co-ordinate: ";
cin>>c2;
cout<<"\n\n¯Enter the  co-ordinates of point D:- \n    Enter x co-ordinate: ";
cin>>d1;
cout<<"\n    Enter y co-ordinate: ";
cin>>d2;
Ar1=0.5*(a1*(b2-c2)+b1*(c2-a2)+c1*(a2-b2));
Ar2=0.5*(a1*(d2-c2)+d1*(c2-a2)+c1*(a2-d2));
Ar=Ar1+Ar2;
cout<<"\n\n  ¯Area= "<<fabs(Ar);
break;
default: cout<<"Wrong input!!!!";
}
getch();
}



===========================================================================


                                OUTPUT