Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prime number guessing game implemented in C++ using Raspberry Pi Obiective: Learn how to find out if a random number is a prime number using

Prime number guessing game implemented in C++ using Raspberry Pi Obiective: Learn how to find out if a random number is a prime number using C++ and using Raspberry Pi's GPIO port as an output device. The Raspberry Pi is a low cost, credit card sized computer that can do everything desktop computers can do, like browsing the internet, playing videos/games, word-processing, and interacting with the outside world-controlling external devices. Definition: A prime number is a number that can only be divided by itself and 1, (integer division). Examples: 1, 2, 3, 5, 7,11, ...etc. Description: This programming exercise is a simple program that generates a random number between 1 and 500, and prints it on the screen. It also asks the user to guess if the number is a prime number or not. The user enters \"y for yes or \"n\" for no. If the answer is correct, the program prints \"You win!\" on the screen, and the Green LED light on the breadboard turns on. If the answer is wrong, the program prints \"You lose!\", and the Red LED light on the breadboard turns on. The program then asks the user if he/she wants to continue playing or exit the program. If the user chooses to continue playing, the lights are turned off, and program repeats by generating another random number, and so on. If the user chooses to exit, the lights are turned off, and the program exits.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students also viewed these Programming questions