Task#1 Assignment in C++
#include<iostream>
using namespace std;
class Election
{
long double RecievedVotes1;
long double RecievedVotes2;
public:
Election() {RecievedVotes1=0;RecievedVotes2=0;}
void VotesTaker(long double RC1,long double RC2)
{
RecievedVotes1=RC1;
RecievedVotes2=RC2;
}
void ShowWinner()
{
if(RecievedVotes1>RecievedVotes2)
{
cout<<"Candidiate 1 is the Winner";
}
else
cout<<"\n\n\n\nCandidiate 2 is the Winner";
}
};
int main()
{long double RC1,RC2;
cout<<"Enter Votes of Candidiate 1\n";cin>>RC1;
cout<<"\nEnter Votes of Candidiate 2\n";cin>>RC2;
Election E1;
E1.VotesTaker(RC1,RC2);
E1.ShowWinner();
}
Comments
Post a Comment