This is simple smart contract for election of two candidates :
pragma solidity 0.4.24;
contract Election {
//Model a candidate
struct Candidate{
uint id;
string name;
uint voteCount;
}
//Store Candidates
//Fetch Candidate
mapping(uint=>Candidate)public candidates;
//Store Candidates Count
uint public candidateCount;
function election()public{
addCandidate("Donald Trump");
addCandidate("Barak Obama");
}
function addCandidate(string memory _name)private{
candidateCount++;
candidates[candidateCount] = Candidate(candidateCount,_name,0);
}
}
Why the output is the default output ? Is the value that i'm passing is invalid ?