C++ problem
Please help me with it. Thank you.

the output would be like this:
|
10-20 with sequence
10 - 30 no sequence:
this is the background:
|
Required program
#include <iostream>
#include <cmath>
using namespace std;
// This function calculates the juggler sequence
void printJuggler(long n, int toPrint, long &largest, long &length)
{
// n is the number whose sequence is to be calculated
// toPrint determines whether to print or not
long a = n;
// print the first term
if (toPrint)
cout << a << ": ";
// calculate terms until last term is not 1
length = 0;
while (a != 1)
{
length++;
long b = 0;
// Check if previous term is even or odd
if (a % 2 == 0)
b = floor(sqrt(a));
else
b = floor(sqrt(a)*sqrt(a)*sqrt(a));
if (toPrint)
{
// print comma only if more terms exist
if (b != 1)
cout << b << ", ";
else
cout << 1 << endl;
}
a = b;
if(b>largest)
largest = b;
}
}
int main()
{
long start, stop;
int toPrint;
cin>>start>>stop>>toPrint;
if (start<2 || stop<2 || start>=stop)
{
cout << "Please enter proper ranges! Exiting!" << endl;
return 1;
}
long maxLength = -1, globalLargest = -1;
long length, largest;
long startMaxLength, startLargest;
for(long i = start ; i <= stop ; i++)
{
largest = -1;
printJuggler(i, toPrint, largest, length);
// if longer sequence found, increase maxLength
if (length > maxLength)
{
maxLength = length;
startMaxLength = i;
}
// if larger number found in sequence, set globalLargest
if (largest > globalLargest)
{
globalLargest = largest;
startLargest = i;
}
}
// print the largest length and the largest number and starting of sequence
cout << startMaxLength << ", " << maxLength << endl;
cout << startLargest << ", " << globalLargest << endl;
return 0;
}
Sample Output:

I have explained the program in details using the comments. Your
question already contains a detailed description of how to generate
the numbers. I hope you find this useful.
C++ problem Please help me with it. Thank you. the output would be like this: 10-20...
Must use Array. Must be in JAVA. Write a program that uses a Scanner object to read in a sequence of integers. The first number in the sequence represents the number of integers in the sequence (i.e., do NOT include the first number as part of the sequence). Create an array of integers that is the same size as the number of integers. Then the program will read each integer and place it in the array. Print the content of...
Hi, I was wondering if you'd be able to help me figure out how to evaluate the sum of the numbers in char data type since built in data type is not applicable (cannot contain 80 digits).(C programming).(the problem is written below). Is it necessary to use multidimensional array ? A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to...
Plz i want answer these question using list in python
programme.
You are given two sequences of n integers: 21, 22, ...,an and b1,b2, ..., bn Print a sequence of 2n integers created by alternating elements from the given sequences: a1, 61, 42, 62, a3, 63, ..., an, bn. Input The first line contains a positive integer n (1 <n<1000) - the length of the sequences The second line contains n space-separated integers 01, 02, ..., an (-1000 <a; <...
This is to be written in C++. Thank you so much for you help as I'm really struggling with this. Must be written in this format: #include <stdio.h> int main(void) { printf("Hello World\n"); return 0; } The explosive growth of Internet communications and data storage on Internet-connected computers has greatly increased privacy concerns. The field of cryptography is concerned with coding data to make it difficult (and hopefully—with the most advanced schemes—impossible) for unauthorized users to read. In this exercise,...
write the program with the language NODEJS need help Programming challenge, screenshot your work and output. Description A positive integer is a palindrome if its decimal representation (without leading zeros, is a palindromic string (a string that reads the same forwards and backwards). For example, the number 5, 77, 363, 4884, 11111, 12121 and 349943 are palindromes A range of integers is interesting if it contains an even number of palindromes. The range [L, R], with L <= R, is...
Hi can anyone help me with this question? Please use python when
you do it. THANKS
1. Arithmetic trees 50 marks You are given an input file with multiple pairs of input lines. The first line of each pair is a tree given as a predecessor array. The second line is the value at the corresponding node. Values at leaf nodes (nodes with no children) are integers. At non-leaf nodes, the two possible values are or * The tree represents...
I need help writing these 2 programs please include all the indents :) In this programming challenge you are to create two Python programs: randomwrite.py andrandomread.py. One program, randomwrite.py, is to write a set of random numbers to a file. The second program, randomread.py, is to read a set of random numbers from a file, counts how many were read, displays the random numbers, and displays the total count of random numbers. Random Number File Writer (randomwrite.py) Create a program...
urgent Help needed in python program ! Thanx # This is a function definition. You can ignore this for now. def parse_integer_list_from_string(string): """ Returns a list of integers from a string containing integers separated by spaces. """ # Split the line into a list of strings, each containing a number. number_string_list = string.split() # Create an empty list to store the numbers as integers. numbers = [] # Convert each string to an integer and add it to the list...
please use c++ programming and single dimensional
arrays to solve this problem
thank you
Problem 02: Large Integer (20 points) In CH, the largest int value is 2147483647. So, an integer larger than this cannot be stored and processed as an integer. Similarly, if the sum or product of two positive integers is greater than 2147483647, the result will be incorrect. One way to store and manipulate large integers is to store each individual digit of the number in an...