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

how would I do this using C++ programming not java. Write a program to play the

ID: 3726714 • Letter: H

Question

how would I do this using C++ programming not java. Write a program to play the lottery. The program randomly generates a lottery of a three-digit number, prompts the user to enter a three-digit number, and determines whether the user wins according to the following rules:

• If the user input matches the lottery number in the exact order, the award is $10,000.

• If all the digits in the user input match all the digits in the lottery number, the award is $3,000.

• If one digit (or two digits) in the user input matches a digit in the lottery number, the award is $1,000.

if anyone could please help me out I would greatly appreciate it!!

Im only in c++ 101 so if there's anyone that knows how to solve this using beginners c++ language please help!

Explanation / Answer

#include<iostream>

#include<cstdlib>

#include<ctime>

using namespace std;

int main(){

int num,k;

srand(time(NULL));

int rnum=rand()%1000;

cout<<rnum<<endl;

cout<<enter your lottery number<<endl;

cin>>num;

if(num!=0){

if(rnum==num)

{

cout<<"The Award is $10,000"<<endl;

}

else{

int count=0;

k=rnum

while(k!=0){

k=k%10;

j=num;

t=j;

while(t!=0){

t=t%10;

if(k==t)

count++;

k=k/10;

break;

else

t=t/10;

}

}

if(count==1)

cout<<"The Award is$1000"<<endl;

else if(count==3)

{

cout<<"The Award is$3000"<<endl;

}

else{

cout<<"No Award"<<endl;

}

}

}