Sunday, October 14, 2018

Voting System In C++ Language.

VOTING SYSTEM IN C LANGUAGE

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
#include<conio.h>
int show(int);
void Admin(int,int,int);
int main()
{
 int p,n,n1,i,pin,reg,k=0,party,id[100],a;
 int party1=0;
 int party2=0;
 int party3=0;
 char ch;
 cout<<("\n1).Admin");
 cout<<("\n2).Voter");
 cout<<("\n3).exit");
 cout<<("\n\t\t\t\tInput the Choice : ");
 p=show(n);
if(p==1)
 {
    Admin(party1,party2,party3);
 }
   else if(p==2)
    {
      while(1)
      {
       cout<<("Enter registration no. : ");
       cin>>reg;
       system("cls");
       int found=0;
       for(i=0;i<=k;i++)
       {
        if(reg==id[i])
            found=1;
       }
        if(found==0)
          {
           id[k++]=reg;
            cout<<("\t\t\t\tChoose the party");
            cout<<("\n1).BJP");
            cout<<("\n2).Congress");
           cout<<("\n3).Aam Aadmi\n");
           scanf("%d",&party);
           system("cls");
           if(party==1)
             party1++;
           else if(party==2)
             party2++;
           else if(party==3)
             party3++;
           else
            break;
         }
     cout<<("Enter 1 to continue and 0 to break");
    cin>>n1;
    system("cls");
    if(n1==1)
     continue;
    else
      {
         cout<<("Enter your choice : ");
        p=show(n);
        if(p==1)
         Admin(party1,party2,party3);
      }
    }
  }
  else
     cout<<("Please Exit the area");
}
void Admin(int party1,int party2,int party3)
{
  char ch;
  int a=0,i;
  int pin;
  pin=1234;
  printf("Enter your four digit pin : ");
  for(i=1;i<=4;i++)
  {
    ch=getch();
    printf("*");
    ch=ch-48;
    a=(a*10)+ch;
  }
   if(party1==party2&&party2==party3)
    {
      cout<<("\nThere will be re-election");
    }
    else if(party1!=party2||party2!=party3||party3!=party1)
    {
     if(a==pin)
     {
      if(party1>party2)
      {
        if(party1>party3)
             cout<<("\nThe winner is BJP\n");
        else
             cout<<("\nThe winner is AAM AADMI Party\n");
      }
       else if(party2>party3)
             cout<<("\nThe winner is congress\n");
       else
         cout<<("\nThe winner is AAM AAdMI Party\n");
     }
    }
     else
     cout<<("\nThe pin is Wrong");
}
int show(int n)
{
 cin>>n;
 return(n);
 system("cls");
}


Electricity bill in c++ language(BY CLEVER_PROGRMAING)

#include<iostream>
#include<conio.h>
int totalbill(int x);  // TOTALBILL FUNCTION.....

using namespace std;


int unit,bill;

int totalbill(int x)
{
unit =x;

if (unit<200)
      {
      bill= 200*2;
      return(bill);
                }
   else
    if (unit<400)
   {
      bill = 200*2 + (unit-200)*4;
      return(bill);
                     }
   else
   if (unit<600)
   {
     bill = 200*2 + 200*4 + (unit-400)*6;
     return(bill);
                   }
   else
   if (unit<800)
  {
bill= 200*2 + 200*4 + 200*6 + (unit-600);
return(bill);
                     }
    else
   if (unit<1000)
  {
bill = 200 *2 + 200*4 + 000*6+ 200*8 + (unit-800)*10;
return(bill);
                     }
   else
   if (unit>1000)
  {
  bill = 200*2+ 200*4 + 200*6 + 200*8 + 200*10 + (unit-1000)*12;
  return(bill);
                    }
             }
int main()
{
int unit,bill,x;
cout<<"enter  the your electricity unit";

cin>>unit;//

//   workprogreesing ................................
cout<<totalbill(unit);
getch();

}

Arrays in Solidity Programming Language.

Arrays Solidity supports both generic and byte arrays. It supports both fixed size and dynamic arrays. It also supports multidimensional ...