Feb 20, 2022
-
Develop, compile, and run a C++ program that requires the definition and use of functions that utilize fundamental algorithms studied to perform common tasks, such as finding the max and min of a data set, counting, summing, tracking a previous value, searching and sorting, reading until EOF, etc. in programs to solve problems.
-
Transfer a program to the Unix server, use the G++ compiler to compile a program and execute a c++ program that you have written
-
Write a C++ program to run a menu-driven program with the following choices:
- Compute all the Cousin Prime Pairs less than a number
- Compute if a number is a Perfect number
- Quit
-
Follow the course coding standards outlined in Coding Standards_ (COP3363 Introduction to Programming in C++ for Majors).docx (Coding Standards) .
-
Include the basic header in your program Header for Assignments.docx (Required Header Template) , and print a welcome message to the user.
-
Write a function called getValidUserInputPosNumGT0 that allows a user to enter in an integer and validated that the number is > 0. It must have a pass by reference parameter that will store the value selected by the user.
void GetValidUserInputPosNumGT0(long int &num);
-
Write a function called SumOfDivisors that takes a number as a value parameter. It returns the sum of the divisors of the number.
long int SumOfDivisors(long int num);
-
Write a function called IsPrime that takes a number as a value parameter. It returns true if the number is prime and false otherwise.
bool IsPrime(long int num);
-
Write a function called DisplayCousinPrimes that takes a number as a value parameter. It displays all the cousin prime pairs less than the number. See Cousin Prime Wiki
void DisplayCousinPrimes(long int num);
-
Write a function called Perfect that takes a number as a value parameter. It returns true if the number is perfect and false otherwise. See Perfect Number Wiki
bool IsPerfect(long int num)
-
Add comments wherever necessary.
- Use
g++ playingWithNumbers.cpp -o playingWithNumbers.exe
and thenplayingWithNumbers.exe
in a Linux terminal to compile and run.