c++ project reports
#include <iostream>
#include<ctime>
using namespace std;
void MinutesHours_conversion();
void Lottery_Draw();
void Draw_SquarePattern();
void TimeConversion(int);
int main()
{
cout << "There are 4 functionality of this project.The following list will give the options to choose for the respective operations. Choose the correct option to proceed.Thank You..!!!"<<endl;
int c=0;//variable to choose from the menu
while(c!=4){
cout<<"\t \t"<<"OPERATIONS"<<endl;
cout<<" \t"<<" 1.Time conversion"<<endl;
cout<<"\t 2.Print a hollow square"<<endl;
cout<<"\t 3.Lottery drawing"<<endl;
cout<<"\t 4.Exit";
cin>>c;
switch(c){
case 1:MinutesHours_conversion();
break;
case 2:Draw_SquarePattern();
break;
case 3:Lottery_Draw();
break;
case 4:break;
default:
cout<<"Wrong choice..!!! Please select valid options from the menu..";
}
}
return 0;
}
void MinutesHours_conversion(){
int min;
cout<<" Time Conversion "<<endl;
cout << " Enter in minutes : ";
cin >> min;
TimeConversion(min);
}
void TimeConversion(int minute){
double j;
double m=(double) minute;
for(j=m;j<=m+20;j++){
cout<<j<<" minutes \t";
cout<<j/60<<"hours";
cout<<"\n";
}
}
void Draw_SquarePattern(){
int sz;
cout<<" Pattern of Hollow Square "<<endl;
cout<< "Enter size:";
cin>>sz;
for(int v=1; v<=sz; v++)
{
if(v <= 1)
for(int v=1; v<=sz; v++)
{
cout<< "#";
}
else if(v<sz)
{
cout<< endl;
for(int w=1; w<=sz; w++)
{
if(w==1 || w==sz)
cout<< "#";
else
cout<< " ";
}}
else
{
cout<< endl;
for(int x=1; x<=sz; x++)
{
cout<<"#";
}
}
}
}
void Lottery_Draw(){
// Declare Variables
int draw_ball,x,opt;
int ball_drawdrawings(int&);
// Title
cout << ' ' << endl;
cout << '\t' << "Lottery Draw!" << endl;
cout << ' ' << endl;
// Call to Function
x=ball_drawdrawings(draw_ball);
// End function
}
int ball_drawdrawings(int&)
{
int draw;
double en(0), sevn(0), x_y_z(0); // The declaration of variable are done here
double percen_en = 0.0, perc_7 = 0.0, perc_123 = 0.0;
int maxps= 1;
int count= 1;
// Input From User
cout << "Enter the number of lottery drawings that is to be simulated ";
cin >> draw;
cout << ' ' << endl;
// Numbers randomized
srand((int)time(NULL)); // To include <ctime> header
while (count <= draw) {
for (int k=1; k<=3; k++)
{
int rounding = rand()%10+1;
cout << rounding << ' ';
if (rounding == 7) {
sevn++;
}
else
{
if ((rounding % 2) == 0) {
en++;
}
else
{
if (rounding == 1 || rounding == 2 || rounding == 3)
{
x_y_z++;
}
}
}
}
cout << ' ' << endl;
maxps= count;
count++;
}
percen_en = (en/(draw*3.0))*100.0;
perc_7 = (sevn/(draw*3.0))*100.0;
perc_123 = (x_y_z/(draw*3.0))*100.0;
// The sreen displays the output
//The checking for precision
cout << ' ' << endl;
cout << "The three ball_draws were even " << percen_en << "% of the time." << endl;
cout << "The number seven appeared on one of the three ball_draws " << perc_7 << "% of the time." << endl;
cout << "The numbers 1, 2, and 3 occured on the ball_draws " << perc_123 << "% of the time." << endl;
cout << ' ' << endl;
return rand();
#include <iostream>
#include<ctime>
using namespace std;
void MinutesHours_conversion();
void Lottery_Draw();
void Draw_SquarePattern();
void TimeConversion(int);
int main()
{
cout << "There are 4 functionality of this project.The following l
ist will give the options to choose for
the respective operations. Choose the correct option to proceed.Thank You..!!!"<<endl;
int c=0;//variable to choose from the menu
while(c!=4){
cout<<"
\
t
\
t"<<"OPERATIONS"<<endl;
cout<<"
\
t"<<" 1.Time co
nversion"<<endl;
cout<<"
\
t 2.Print a hollow square"<<endl;
cout<<"
\
t 3.Lottery drawing"<<endl;
cout<<"
\
t 4.Exit";
cin>>c;
switch(c){
case 1:MinutesHours_conversion();
break;
case 2:Draw_SquarePattern();
break;
case 3:Lottery_Draw();
break;
case 4:break;
#include <iostream>
#include<ctime>
using namespace std;
void MinutesHours_conversion();
void Lottery_Draw();
void Draw_SquarePattern();
void TimeConversion(int);
int main()
{
cout << "There are 4 functionality of this project.The following list will give the options to choose for
the respective operations. Choose the correct option to proceed.Thank You..!!!"<<endl;
int c=0;//variable to choose from the menu
while(c!=4){
cout<<"\t \t"<<"OPERATIONS"<<endl;
cout<<" \t"<<" 1.Time conversion"<<endl;
cout<<"\t 2.Print a hollow square"<<endl;
cout<<"\t 3.Lottery drawing"<<endl;
cout<<"\t 4.Exit";
cin>>c;
switch(c){
case 1:MinutesHours_conversion();
break;
case 2:Draw_SquarePattern();
break;
case 3:Lottery_Draw();
break;
case 4:break;