[SOLVED] Write a program to ask the user to enter 6 numbers and store them into an integer

20.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

Write a program to ask the user to enter 6 numbers and store them into an integer array. Then examine the array, if the numbers in the array are all unique, display message “All unique!”, otherwise display the message “Not all unique!”.
Sample run 1:
enter a number: 1
enter a number: 87
enter a number: 3
enter a number: 19
enter a number: 56
enter a number: 777
All unique!
Sample run 2:
enter a number: 8
enter a number: 9
enter a number: 10
enter a number: 8
enter a number: 10
enter a number: 788
Not all unique!
Directions: Use the following program structure for your main.
int main() {
int myArray[6];
// code to fill in the array from the user
// code to determine if all of the values are unique
return 0;
}
NOTE: DO NOT USE GLOBAL VARIABLES!!!!!
A global variable is a variable that is defined outside of any function
(including main). We don’t cover them in this course because they are generally
a very bad idea. So, don’t do this in your projects!
ALSO: DO NOT USE ANY ASPECT OF C++ WHICH IS NOT COVERED IN THIS COURSE. This includes libraries, etc.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.