Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, I\'m working with the below C++ code and I would like to limit thenumber

ID: 3615480 • Letter: H

Question

Hello,
I'm working with the below C++ code and I would like to limit thenumber of times from 5 to 1 the question of "Enter your five digitlottery pick".

I can't figure this out, but I believe it has to do with theloop.

Any suggestions?

#include <iostream>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;


int main()
{
    const int SIZE = 5;
    int lottery[SIZE];
    int user[SIZE];
    int match;
    int count;

    //seed random number generator
    srand((unsigned int)time(0));
        for (count = 0; count <SIZE; count++)
        {
        lottery[count] = 0 + rand() %9;
        }
    //User enters lottery numbers
        for (count = 0; count <SIZE; count++)
        {
        cout << "Enter your 5digit lottery pick: " ;
        cin >> user[count];
        }
    //Match number in array
        match = 0;
        for(count = 0; count <SIZE; count++)
           if(user[count] == lottery[count])
           match++;
            cout<< "lottery numbers: ";

    //Print lottery numbers and User numbers
        for(count = 0; count <SIZE; count++)
        cout << lottery[count]<< " ";
        cout << " Yournumbers:    ";

    //To announce grand prize winner
        for(count = 0;count <SIZE; count++)
        cout << user[count]<<" ";
        cout << " matches: "<< match << endl;
            if(match== SIZE)
            cout<< "Your are the grand prizewinner!!! ";     
           


return 0;
}

Explanation / Answer

please rate - thanks move the prompt outside the loop #include #include #include #include using namespace std; int main() {     const int SIZE = 5;     int lottery[SIZE];     int user[SIZE];     int match;     int count;     //seed random number generator     srand((unsigned int)time(0));         for (count = 0; count
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote