CS201 Assignment 2 Solution Fall 2020


#include
#include
#include
using namespace std;
//
void showElements();
void PercentageBiden ();
void PercentageTrump();
void PercentageJorgensen();
void line();

float per[4];
unsigned long vote[3][5]={
{ 1, 5284453, 5658847, 70046, 110133462},
{ 2, 2465781, 2455428, 61894, 4983103},
{ 3, 2790648, 2644525, 60287, 5495460},
};
int main()
{
int option;
cout<<" Assignment Solved by Abdul Hadi E Services" <
showElements();
opt:
  {
Opt:
{
cout<<" Press the states code to calcalculate percentage of Trum, Biden and Jorgensen Votes"<
cout<<"Press 1 for Florida."<
cout<<"Press 2 for Georgia."<
cout<<"Press 3 for Michigan."<
cout<<"Press 4 for Exit."<
cout<<" Please Select an Option, use numbers from 1 to 4 :   ";
cin>>option; 
}
switch(option)
{
case 1:
line();
PercentageBiden ();
{
cout<<" Percentage of Jo Biden votes is: "<
cout<<" Percentage of Donald Trump votes is: "<
cout<<" Percentage of Jo Jorgensen votes is: "<
goto opt;
}
break;
case 2:
line();
PercentageTrump();
{
cout<<" Percentage of Jo Biden votes is: "<
cout<<" Percentage of Donald Trump votes is: "<
cout<<" Percentage of Jo Jorgensen votes is: "<
goto opt;
}
break;
case 3:
line();
PercentageJorgensen();
{
cout<<" Percentage of Jo Biden votes is: "<
cout<<" Percentage of Donald Trump votes is: "<
cout<<" Percentage of Jo Jorgensen votes is: "<
goto opt;
}
break;
case 4:
return(0);
break;
default:
{
cout<<" Choice should be Between 1 to 4 " <
cout<<" Invalid Choice, Please Select again: " <
goto opt;
}
}
system ("Pause");
}
}
//Showing all data in arr
void showElements()
{
int b,c;
cout<<" Source Data: States Biden Votes Trump Votes Jorgensen Votes TotalVotes ";
for (b=0; b<3; b++)
{
for (c=0; c<5; c++)
cout<
cout<
}
}
void PercentageBiden()
{
int b;
for (b=1; b<4; b++)
per[b]=float(vote[0][b])/11013346.0*100;
}
void PercentageTrump()
{
int b;
for (b=1; b<4; b++)
per[b]=float(vote[1][b])/4983103.0*100;
}
void PercentageJorgensen()
{
int b;
for (b=1; b<4; b++)
per[b]=float(vote[2][b])/5495460.0*100;
}
void line()
{
cout<<" --------------------------------------------";
}

Comments

Popular posts from this blog

MGMT 627 Assignment Solution Idea

MGT501 - Human Resource Management Assignment No.1 Fall 2020

CS101 Assignment no 2