Appendix D- Pom Dance

 

#include <iostream.h>

#include <stdlib.h>

#include <math.h>

 

/*The Rhythm of Hailstones: Pom. This program uses logarithms and the Hailstone

Theory to output a sequence of numbers. Each number corresponds to a video clip

for the Pom dance routine. There are 51 different dance routines that can be

created by this program.*/

 

/*This is the main function of the program. It includes the Hailstone Theory

formulas and the logarithmic function.*/

//function@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

void hailstone()

{

int a;//starting number

cout<<"Enter a number between 50 and 100."<<endl;//user inputs starting number

cin>>a;

if(a<50 || a>100)//limits range

{

cout<<"The number you entered is not in the 50-100 range"<<endl;

hailstone();

}

for(int count = 0; a!=1; count++)

 {

 if(a%2==0)//checks if number is even

 {

//if number is even

a=(a/2);

 }

 else

 {

//if number is odd

a=(3*a+1);

 }  

cout.setf(ios::fixed);

cout.precision(0);//limits output numbers to 0 decimal places

double f=((9)*log10(a));//logarithmic function

cout <<f<<"   ";//final output sequence

}

cout<<endl;

cout<<endl;

cout<<"Now you can match the numbers in the sequence above to the Pom video clips in"<<endl;

cout<<"Windows Movie Maker."<<endl;

cout<<"Then put them in the order of the sequence above and add music."<<endl;

cout<<endl;

cout<<endl;

char answer;

cout<<"Do you want to create another dance routine? (Y/N)"<<endl;

cin>> answer;

if((answer=='y')||(answer=='Y'))

hailstone();

}

//function#################################################################

int main()

{

cout<<"\t\t###########   ##########    ####     ####"<<endl;

cout<<"\t\t##             ##   ##            ##  ##  ##   ##  ##"<<endl;

cout<<"\t\t##             ##   ##            ##  ##   ## ##   ##"<<endl;

cout<<"\t\t##             ##   ##            ##  ##    ###     ##"<<endl;

cout<<"\t\t###########   ##            ##  ##      #       ##"<<endl;

cout<<"\t\t##                    ##            ##  ##               ##"<<endl;

cout<<"\t\t##                    ##            ##  ##               ##"<<endl;

cout<<"\t\t##                    ##            ##  ##               ##"<<endl;

cout<<"\t\t##                    ##########   ##               ##"<<endl;

cout<<endl;

cout<<endl;

hailstone();

      system("PAUSE");

      return 0;

}