fizz buzz

re.bertyh.elpsfuben.t

Individual: FizzBuzz Program, Part 1

Instructions:

Write a console-based C++ program that requests the user to input a

single positive integer as input and outputs a result based on the input

value:

Please enter number, then press Enter key: 8

The program will then write the following output according to the

following rules:

1. If the number is divisible by 3. The program will give the output

"Number: # - Fizz"

Please enter a number, then press Enter key: 6

Output: Number: 6 - Fizz

2. If the number is divisible by 5. The program will give the output

"Number: # - Buzz"

Please enter a number, then press Enter key: 10

Output: Number: 10 - Buzz

3. If the number is both divisible by 3 and 5. The program will give the

output "Number: # - FizzBuzz"

Please enter a number, then press the Enter Key: 30

Output: Number: 30 - FizzBuzz

3. If the number is not divisible by either 3 or 5, the program will give

the output "Number: # - NoMatch"

Please enter a number, then press the Enter Key: 4

Output: Number: 4 - NoMatch

Expand this to accept a comma or space separated list of numbers and

print the output of each number according to the rules above. (Prompt

the user whether to use a space or comma when the program starts.)

Example: Please enter an array of number(s): 3,10,30,4

Output: Number: 3 - Fizz, Number: 10 - Buzz, Number: 30 - FizzBuzz,

Number: 4 - NoMatch

Note. Use new to allocate storage (new int) for each input number) and

put the input numbers into an array or list (from the ones available in

the Standard Template Library).

Also Note: Make sure the program handles an arbitrary number of

input numbers not just the ones listed here. The numbers will not

necessarily be in any specific order or be limited to 4 items, that will

depend on what the user enters. Using an STL storage class will allow

an arbitrary number of numbers and you do not need to worry about

running out of memory.

Include a proper header file.

Use proper coding conventions and proper comments throughout your

program.

Submit a single final program having all the full functionality from the

expanded section above.

Compress all your Microsoft® Visual Studio® source code files in the

console application folder into a ZIP file. The submitted folder must

properly launch by clicking the project file at the top level and link to all

the needed files. Visual Studio® must be used for this assignment.

Submit your zipped assignment using the Assignment Files tab.

  • 8 years ago
  • 5
Answer(0)