How to place same character at different position in 2D array

2012-09-13  Source: Original Site  Category:C++  Views:0 

Advertisement

I have made the treasure hunt game using 2D array. where '#' are the walls '*' is the border of the game.

i want to place '@' as tresure at random postion between the spaces of 2D Array of size
[20][20].
i know i have to use
#include<time.h>

time_t t;
time(&t);
srand(t);
int r = rand() % 18; r is the position for y position of 2D array.

but i have to place '@' at more than one place and at different position.
and other thing '@' char cant be place on the borders.

treasure on each space line could be 3,2 or 1 but not 0.

Related articles
  • How to place same character at different position in 2D array 2012-09-13

    I have made the treasure hunt game using 2D array. where '#' are the walls '*' is the border of the game. i want to place '@' as tresure at random postion between the spaces of 2D Array of size [20][20]. i know i have to use #include<time.h> ti

  • Ubuntu [Regular Expression] Matching the same character in different spots? 2014-11-20

    I am just learning regular expressions and was wondering if there was a way to match the same character in different spots. take for example, the following example: aaathdfjehsdyaaaWould match three of the same character at the beginning, and random

  • Oracle How to place the regions in required positions 2013-03-10

    Hi I have a requirement like below to place the regions Region_Seq_10 Region_Seq_20 Region_Seq_30 Region_Seq_40 Region_Seq_50 Region_Seq_60 How Can I design exactly above mentione way of positioning the regions.

  • How to share same resource for different languges?? 2013-06-12

    I pasted this message yesterday but no answers yet. Can anybody help? I am adding a Japanese build in my project. Say I have 20 different bitmaps in the project, How can I share these 20 bitmaps for my Japanese build? For now what I did was to insert

  • How to support same model across different stages of implementation 2013-10-24

    Scenario: One 'common' model use to generate/ transform in WSDL/XSD's. Different parallel streams of modeling inside RSA that needs to share this common model (thus Objects) with different implementation dates. Team one implements (thus model - trans

  • how to set same width for different inputs 2014-08-28

    I have a bit of a situation, I need to aligned a textarea with a dropdown in IE6 In my browser I put a fix value style="width:xx" and on the textarea also a fixed value for column until I made them match... not the idea solution but it worked. When i

  • jQuery [Help] How to perform same functions on different tags. 2014-10-09

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.2900.2964" name=GENERATOR></HEAD> <BODY

  • Oracle How to pass same value to different page in application???? 2013-07-08

    I am having 3 pages with few number of fields on each page but one field is common on all the pages(ie id). Now my question is after user enters ID value on 1st page, the value should be display to the next coming pages of the ID field?????any idea g

  • How to place correct HYPHENS for different browsers 2013-09-07

    I have a very thin sidebar with text paragraphs in it that show up a little differently in the different browsers, therefore any hyphens need to be rendered within each individual browser. I tried placing &shy in all the possible spots for hyphen

  • MySQL Please help me in merging for same tables in different databases 2013-12-07

    I request to please help how can merge same tables at different databases. i am having stockdetails & partsmaster two tables at different databases names of same username how can make a query to merge all that stockdetails & partsmaster detai

  • same #define with different parameters 2014-05-02

    I'm putting some defines to my project to help debugging. I ran into troubles when I tried to do something like this: #ifdef DEBUG // define with three parameters #define TEST_DX(a,b,c); if (FAILED(a)) { MESSAGE(b,a); return c; } // define with diffe

  • Oracle How to set NLS_LANG when link different character set dbs simultaneously? 2012-01-11

    We have a AP server developed by .NET. For some reason, the AP server's NLS_Lang is set the same Character set as DB Server, i.e. WE8DEC, and store chinese words into the DB. So we must keep NLS_Lang to WE8DEC to get correct data. But now, we want to

  • Ubuntu how to detect same mp3 file with different names? 2013-07-26

    I have many mp3 files but many of them are actually same files with different names. Simple file size is not good enough to detect same mp3. How can I detect automatically same mp3 files without playing every single mp3?

  • In Ubuntu 9.04, how do I mount different folders of the same partitions to different 2014-06-01

    In Ubuntu 9.04, how do I mount different folders of the same partitions to different folders? Im starting a pay per click program for a product. When running ppc campaings what is a good number amount of keywords to use?

  • A same product with different versions: How can I do? 2014-06-24

    A same product with different versions: How can I do? Hi, We are adopting RUP in our project few months ago. We started pick up a new project or software product. In this moment this software product has the first version. Now, the sponsor need to th

  • Oracle How to share the same cookie between different workspaces? 2015-03-08

    I can share same cookie in different applications of one workspace. But How to share the same cookie between applications of different workspaces? Is it possible? Jerry

  • Oracle How to create directories with same name in different schemas 2013-09-09

    I have two schemas on the same database. I am trying to create directories with same name, but different paths in both the schemas. When i created the directories in second schema, the directory paths of the first schema are automatically changed to

  • How can I use chars from different charsets? 2014-05-05

    everyone, I'm looking for some help. What I'd to know is how to refer to characters from different charsets like Herbrew or Japanese characters simultaneously, as well as English and all others within the same script block. E.g, [code] if ( xx[K]=="C

  • How to place multiple items on the clipborad? 2014-10-18

    I tried to find out the answer from existing posts without success. According to the book "Programming Windows with MFC" by Jeff Prosise( page 1094-1095 ), it is quite easy to place two or more items on the clipboard: ::SetClipboardData(CF_BITMAP, hB

  • Javascript - Load same function for different form 2012-01-28

    Can anyone please explain how to apply sama function in javascript for different html form. What, i did is, try to get the name of html form, then assign it to a variable. than try to use the variable in function. But, this return error. Any help gre