//storing one voter address pragma solidity ^0.4.17; contract Vote { string canditate1_name; string canditate2_name; uint256 Count_canditate1_vote; uint256 Count_canditate2_vote; address voter; function Vote (string _canditate1Name, string _candidate2_name){ canditate1_name=_canditate1Name; canditate2_name=_candidate2_name; } function getCountofCandidate1() public view returns(uint256){ return Count_canditate1_vote; } function getCountofCandidate2() public view returns(uint256){ return Count_canditate2_vote; } function SetVote(uint256 _can){ require(msg.sender!=voter); if(_can==1){ Count_canditate1_vote=Count_canditate1_vote+1; } else if(_can==2){ Count_canditate2_vote=Count_canditate2_vote+1; } voter=msg.sender; } function getWinner() public view returns(string) { if(Count_canditate1_vote>Count_canditate2_vote){ return canditate1_name; } else { return canditate2_name; } } }