473,396 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help need?

can anyone help me with this program using array.. im new wit c++

Write a program that simulates a lottery. The program should have an
array of five integers named lottery, and should generate a random
number in the range of 0 through 9 for each element in the array. The
user should enter five digits which should be stored in an integer
array named user. The program is to compare the corresponding elements
in the two arrays and keep a count of the digits that match. For
example, the following shows the lottery array and the user array with
sample numbers stored in each. There are two matching digits (elements
2 and 4).

lottery array:
5 2 6 9 1

user array:
1 3 6 8 1

The program should display the random numbers stored in the lottery
array and the number of digits matching digits. If all of the digits
match, display a message proclaiming the user as a grand prize winner.
Jun 26 '07 #1
3 2224
su********@gmail.com wrote:
can anyone help me with this program using array.. im new wit c++
Because you are new to C++, the idea is that you practise C++ so that
you learn it. Try solving the problem by yourself. When you get stuck
post the code you have written here and ask specific questions about it.
That way you will get help.

Don't expect this group to do your homework for you, you must at least
*try* to do it yourself.

john
Jun 26 '07 #2
John Harrison wrote:
su********@gmail.com wrote:
>can anyone help me with this program using array.. im new wit c++

Because you are new to C++, the idea is that you practise C++ so that
you learn it. Try solving the problem by yourself. When you get stuck
post the code you have written here and ask specific questions about it.
That way you will get help.

Don't expect this group to do your homework for you, you must at least
*try* to do it yourself.

john
Look at the problem description

'generate a random number in the range of 0 through 9 for each element
in the array'

'compare the corresponding elements in the two arrays and keep a count
of the digits that match'

'display the random numbers stored in the lottery array'

etc.

These are small sub-problems in the overall problem. Pick one of these
smaller sub-problems first, and try to solve that. Don't try to do the
whole thing at once. Start with something smaller and easier and
gradually work your way up to the whole thing.

john
Jun 26 '07 #3
su********@gmail.com wrote:
can anyone help me with this program using array.. im new wit c++

Write a program that simulates a lottery.
[snip]

This is covered in the FAQ [5.2 and 5.3]:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.2

Try it yourself, and if you get stuck, then follow the guidelines given
in 5.8:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
5
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator='...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
5
by: Steve Teeples | last post by:
Can someone point me to a document that clearly identifies the steps of creating a good help system for an application? I have a test tool that I'd like to add help to so that others will know how...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.