Cullen and Woodall numbers: Difference between revisions

Content deleted Content added
PSNOW123 (talk | contribs)
m Correcting spelling mistake.
PSNOW123 (talk | contribs)
Minor Improvements to code.
Line 529: Line 529:
enum NumberType { Cullen, Woodhall };
enum NumberType { Cullen, Woodhall };


uint32_t next_number(NumberType number_type) {
uint32_t next_number(const NumberType& number_type) {
number += 1;
number += 1;
power <<= 1;
power <<= 1;
Line 539: Line 539:
}
}


void number_sequence(uint32_t count, NumberType number_type) {
void number_sequence(const uint32_t& count, const NumberType& number_type) {
std::string type = ( number_type == Cullen ) ? "Cullen" : "Woodhall";
std::string type = ( number_type == Cullen ) ? "Cullen" : "Woodhall";
std::cout << "The first " << count << " " << type << " numbers are:" << std::endl;
std::cout << "The first " << count << " " << type << " numbers are:" << std::endl;