I need to write a program, that if anyone ever played memory when they were younger does exactly that, that asks a user for 8 numbers. the numbers the user inputs need to be scattered across a 4x4 array. for example if a user enters 4 there need to be two of them in different sections of the array. so there will be a total of 16 "cards" or numbers. then the user will enter a array block to check two to check if they are equal - just like the game memory. im having problems knowing how to separate the list of numbers that the user inputs to enter each number into a different array. CAN ANYONE HELP PLEASE!!
angleyz14 0 Newbie Poster
Recommended Answers
Jump to PostYou need to know about
- 2-dimensional arrays
- random number generating
- user inputWhat do you have so far?
Jump to PostOne of the ideas you should adopt early is "avoid copy and paste" as much as possible. You have the following blocks repeated, with minor changes, many times.
i=0; j=0; cout<<"Enter first number "; cout<<endl; cin>>num1; game[i][j]=num1; i++; game[i][j]=num1; i++; cout<<"Enter second number "; cout<<endl; cin>>num2; game[i][j]=num2; …
All 7 Replies
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
Sky Diploma 571 Practically a Posting Shark
Arne Kristoffer 0 Light Poster
angleyz14 0 Newbie Poster
Arne Kristoffer 0 Light Poster
angleyz14 0 Newbie Poster
vmanes 1,165 Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.