One Function at a Time (Hailstone Sequence)
Good afternoon everyone, I'm currently working on the following program: __________________________________________________________ // Tab stops: 4 //The program will use a given integer from the user to compute a //a particular sequence. Tab tops 4. #include <iostream> #include <cstdio> using namespace std; //Function Variable Declaration. int hailstone_Sequence(int n), lengthof_Sequence(int l); int[] hailstone_List [ ]; //void Print_Set(int [] set, int size); int main(int argc, char** argv) { int user_Input; cin >> user_Input; cout << "What number shall I start with? " << user_Input << endl; cout << "The hailstone of sequence starting at " << user_Input << " is: " << hailstone_Sequence(user_Input) << endl; cout << "The length of the sequence is ___. \n"; cout << "The largest number in the sequence is: \n"; cout << "The longest hailstone sequence with a number up to __ has length ___ "; cout << "The longest hailstone sequence with a number up to __ begins with ___ "; return 0; } /* The hailstone sequence takes an integer (n) that is greater than 1 from the user. If // n is even, computes n/2. If n is odd, computes 3n+1. Both are done till integer 1 // is reached. */ int hailstone_Sequence (int n) { if (n > 1) { while (n != 1) { if ((n % 2) == 0 ) { return n / 2; } else { return (3*n) + 1; } } } } // int lengthof_Sequence(int l); // { // // // // // // } // void Print_Set(int [] set, int size) // { // // // // } ____________________________________________________ The program is to use an integer provided by the user for a Hailstone Sequence, then to list the Sequence out. Example: user integer: 22 list: #, #, #, #, #,