1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
#include "Class Definition.h"
void voting_system::voting_option_1stplace(string n1,string n2,string n3,int a,int b,int c)
{
int vote;
int choice;
cout<<"You Are Voting for President of the club"<<endl;
cout<<"Would You Like To Vote?"<<endl<<endl;
cout<<"1=Yes, 2=No : ";
cin>>vote;
if (vote == 1)
{
cout<<"\nThese are the nominees:"<<endl<<endl;
cout<<"1. ="<<n1<<endl;
cout<<"2. ="<<n2<<endl;
cout<<"3. ="<<n3<<endl;
ask:
cout<<"Enter Your Choice Here: ";
cin>>choice;
if (choice == 1)
{
cout<<""<<endl;
cout<<"You voted for "<<n1<<endl;
one=one+5;//nom1 gets 5 points
}
else if (choice == 2)
{
cout<<""<<endl;
cout<<"You voted for "<<n2<<endl;
two=two+5;//nom2 gets 5 points
}
else if (choice == 3)
{
cout<<""<<endl;
cout<<"You voted "<<n3<<endl;
three=three+5;//nom3 gets 5 points
}
else
{
cout<<"You Didn't Enter An Available Option"<<endl;
goto ask;
}
}
}
void voting_system::voting_option_2ndplace(string n1,string n2,string n3,int a,int b,int c)
{
int vote;
int choice;
cout<<"You Are Voting for 1st Committee member of the club"<<endl;
cout<<"Would You Like To Vote?"<<endl<<endl;
cout<<"1=Yes, 2=No : ";
cin>>vote;
if (vote == 1)
{
cout<<"\nThese are the nominees:"<<endl<<endl;
cout<<"1. ="<<n1<<endl;
cout<<"2. ="<<n2<<endl;
cout<<"3. ="<<n3<<endl;
ask:
cout<<"Enter Your Choice Here: ";
cin>>choice;
if (choice == 1)
{
cout<<""<<endl;
cout<<"You voted for "<<n1<<endl;
one=one+3;//nom1 gets 3 points
}
else if (choice == 2)
{
cout<<""<<endl;
cout<<"You voted for "<<n2<<endl;
two=two+3;//nom2 gets 3 points
}
else if (choice == 3)
{
cout<<""<<endl;
cout<<"You voted "<<n3<<endl;
three=three+3;//nom3 gets 3 points
}
else
{
cout<<"You Didn't Enter An Available Option"<<endl;
goto ask;//goes back to question
}
}
}
void voting_system::voting_option_3rdplace(string n1,string n2,string n3,int a,int b,int c)
{
int vote;
int choice;
cout<<"You Are Voting for 2nd Committee member of the club"<<endl;
cout<<"Would You Like To Vote?"<<endl<<endl;
cout<<"1=Yes, 2=No : ";
cin>>vote;
if (vote == 1)
{
cout<<"\nThese are the nominees:"<<endl<<endl;
cout<<"1. ="<<n1<<endl;
cout<<"2. ="<<n2<<endl;
cout<<"3. ="<<n3<<endl;
ask:
cout<<"Enter Your Choice Here: ";
cin>>choice;
if (choice == 1)
{
cout<<""<<endl;
cout<<"You voted for "<<n1<<endl;
one=one+1;
}
else if (choice == 2)
{
cout<<""<<endl;
cout<<"You voted for "<<n2<<endl;
two=two+1;
}
else if (choice == 3)
{
cout<<""<<endl;
cout<<"You voted "<<n3<<endl;
three=three+1;
}
else
{
cout<<"You Didn't Enter An Available Option"<<endl;
goto ask;
}
}
}
void voting_system::display_points(string n1,string n2,string n3,int a,int b,int c)
{
cout<<"Nominee number"<<setw(20)<<"Nominee Name"<<setw(30)<<"Standing(total points)"<<endl;
cout<<"1"<<setw(32)<<n1<<setw(20)<<a<<endl;
cout<<"2"<<setw(32)<<n2<<setw(20)<<b<<endl;
cout<<"3"<<setw(32)<<n3<<setw(20)<<c<<endl;
cout<<"4"<<setw(32)<<"nominee no."<<setw(20)<<"points"<<endl;
}
void Mem_Particulars::setID_Name_ad_hp(string id,string n,string ad,string hp)
{
cout<<"(Voter)Enter your student admin no. :";
getline(cin,id);
cout<<"(Voter)Enter your name :";
getline(cin,n);
cout<<"(Voter)Enter your address :";
getline(cin,ad);
cout<<"(Voter)Enter your handphone number :";
getline(cin,hp);
idNum=id;
name=n;
address=ad;
hpno=hp;
fflush(stdin);
}
void Mem_Particulars::showData()
{
cout<<"\nStudent ID= :"<<idNum;
cout<<"\nStudent Name= :"<<name;
cout<<"\nStudent Address = :"<<address;
cout<<"\nStudent Handphone no.= :"<<hpno;
cout<<endl<<endl;
}
void Mem_Particulars::write_in_data()
{
ofstream Name;
Name.open("d:\\Mem_particulars.txt",ios::app);
Name<<idNum<<"\n"<<name<<"\n"<<address<<"\n"<<hpno<<endl;
Name.close();
}
void Nom_Particulars::nom1_setID_Name_ad_hp(string id,string name,string ad,string hp)
{
cout<<"(Nominee)Enter your student admin no. :";
getline(cin,id);
cout<<"(Nominee)Enter your name :";
getline(cin,name);
cout<<"(Nominee)Enter your address :";
getline(cin,ad);
cout<<"(Nominee)Enter your handphone number :";
getline(cin,hp);
idNum=id;
n1=name;
address=ad;
hpno=hp;
fflush(stdin);
}
void Nom_Particulars::nom1_showData()
{
cout<<"\nNominee ID= :"<<idNum;
cout<<"\nNominee Name= :"<<n1;
cout<<"\nNominee Address = :"<<address;
cout<<"\nNominee Handphone no.= :"<<hpno;
cout<<endl<<endl;
}
void Nom_Particulars::nom1_write_in_data()
{
ofstream Name;
Name.open("d:\\Nom_particulars.txt",ios::app);
Name<<idNum<<"\n"<<name<<"\n"<<address<<"\n"<<hpno<<endl;
Name.close();
}
void Nom_Particulars::nom2_setID_Name_ad_hp(string id,string name,string ad,string hp)
{
cout<<"(Nominee)Enter your student admin no. :";
getline(cin,id);
cout<<"(Nominee)Enter your name :";
getline(cin,name);
cout<<"(Nominee)Enter your address :";
getline(cin,ad);
cout<<"(Nominee)Enter your handphone number :";
getline(cin,hp);
idNum=id;
n2=name;
address=ad;
hpno=hp;
fflush(stdin);
}
void Nom_Particulars::nom2_showData()
{
cout<<"\nNominee ID= :"<<idNum;
cout<<"\nNominee Name= :"<<n2;
cout<<"\nNominee Address = :"<<address;
cout<<"\nNominee Handphone no.= :"<<hpno;
cout<<endl<<endl;
}
void Nom_Particulars::nom2_write_in_data()
{
ofstream Name;
Name.open("d:\\Nom_particulars.txt",ios::app);
Name<<idNum<<"\n"<<name<<"\n"<<address<<"\n"<<hpno<<endl;
Name.close();
}
void Nom_Particulars::nom3_setID_Name_ad_hp(string id,string name,string ad,string hp)
{
cout<<"(Nominee)Enter your student admin no. :";
getline(cin,id);
cout<<"(Nominee)Enter your name :";
getline(cin,name);
cout<<"(Nominee)Enter your address :";
getline(cin,ad);
cout<<"(Nominee)Enter your handphone number :";
getline(cin,hp);
idNum=id;
n3=name;
address=ad;
hpno=hp;
fflush(stdin);
}
void Nom_Particulars::nom3_showData()
{
cout<<"\nNominee ID= :"<<idNum;
cout<<"\nNominee Name= :"<<n3;
cout<<"\nNominee Address = :"<<address;
cout<<"\nNominee Handphone no.= :"<<hpno;
cout<<endl<<endl;
}
void Nom_Particulars::nom3_write_in_data()
{
ofstream Name;
Name.open("d:\\Nom_particulars.txt",ios::app);
Name<<idNum<<"\n"<<name<<"\n"<<address<<"\n"<<hpno<<endl;
Name.close();
}
|