Sponsored Content
Top Forums Programming Map with struct as key and vector as value Post 302917420 by yifangt on Tuesday 16th of September 2014 02:05:23 PM
Old 09-16-2014
One of my original purposes of this practice is to experience more on vector and map, especially using a struct as key and vector for value in the map, so that I really did not mean to take the mximum resistance path. I like the slang "There are always more than one way to do it", and I tend to over-think many problems before I get to "take the minimum resistance path", but my always problem is how to find out the minimum resistance path.
Of course each unique student ID should be stored only once but not the student name, cases are students with same name but different ID number.
Thanks anyway and I will try using your method first then go back to the map<struct, vector<struct>> method, only for practice purpose to make a running code. Thanks a lot again!
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

2. Programming

Vector Traversing

Hi i have the following structure struct S { char Mod_num; char val; char chr_nm_cd; } I am reading a 2GB file and inserting into the structure and writing into a vector. I feel like only vector will be a right option. I tried with multimap but it is memory intensive and hence i... (1 Reply)
Discussion started by: dhanamurthy
1 Replies

3. UNIX for Dummies Questions & Answers

How to access a struct within a struct?

Can someone tell me how to do this? Just a thought that entered my mind when learning about structs. First thought was: struct one { struct two; } struct two { three; } one->two->three would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies

4. Programming

C++ Map using a Vector as a Value Type?

I modified some code I found on Wikipedia concerning maps to see if it would work before applying it to a project I'm working on that has a similar idea. What I would want is for a user to be able to enter sentences and then be able to distinguish how many times a the person entered a word in a... (4 Replies)
Discussion started by: kcgb20
4 Replies

5. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

6. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies

7. Programming

Array and Vector

Hi all, from my understanding I understand that I can use array in this manner. struct test { int a; int b; int c; }; test testing; //creating an array with the structer type testing.a=1; testing.b=2; testing.c=3; If I'm not wrong we can use array in this manner,... (12 Replies)
Discussion started by: vinzping
12 Replies

8. Programming

vector c++

hello guys. i'm new to c++. i've problem using two dimensional vector. i've a project of making conway's game of life. this is the code that i have made so far. my problem is how can i give a two dimensional vector through main. glider.vec1 = vec; is not correct way to give a two... (2 Replies)
Discussion started by: nishrestha
2 Replies

9. Shell Programming and Scripting

Vector normalisation

In AWK For 3 individual vectors of the form: -2.772 -9.341 -2.857 -5.140 -6.597 -1.823 -2.730 -5.615 1.159 I would like to write a script that parses line by line to (i) normalise, (ii) divide by the norm for *each* vector. I.e. sqrt(-2.772^2 + -9.341^2 + -2.857^2)=10.154 ... (4 Replies)
Discussion started by: chrisjorg
4 Replies
raster3dintro(1grass)						Grass User's Manual					     raster3dintro(1grass)

3D Raster data (voxel) in GRASS GIS
   3D Raster (voxel) import
       The  module  r3.in.ascii  supports  generic  x,y,z  import.  Alternatively, voxels can be generated from 3D point vector data (v.to.rast3).
       Always the full map is imported.  Volumes can also be created based on 2D elevation map(s) and value raster map(s) (r.to.rast3elev). Alter-
       natively, a volume can be composed of several 2D raster map slices which are merged into one 3D raster volume map (r.to.rast3).

   Voxel region settings and 3D MASK
       GRASS  3D  raster  map processing is always performed in the current 3D region settings (see g.region, -p3 flags), i.e.	the current region
       extent, vertical extent and current 3D resolution are used.  If the 3D resolution differs from that of the input raster map(s),	on-the-fly
       resampling  is  performed (nearest neighbor resampling).  If this is not desired, the input map(s) has/have to be reinterpolated beforehand
       with one of the dedicated modules.  Masks can be set (r3.mask).

   Voxel operations
       Powerful 3D map algebra is implemented in r3.mapcalc.

   Voxel conversion to vector or 2D raster maps
       3D vector point data can be converted to a GRASS 3D raster map (v.to.rast3).  Layers from a 3D raster map can be converted to a	2D  raster
       map (r3.to.rast).  Cross sectional 2D raster map can be extracted from 3D raster map based on a 2D elevation map (r3.cross.rast).

   Voxel statistics
       Volume statistics can be calculated with r3.stats and r3.univar.

   Voxel interpolation
       From 3D vector points, GRASS 3D raster maps can be interpolated (v.vol.rst). Results are volumes, or 2D raster maps can be also extracted.

   Voxel export
       GRASS 3D raster maps can be exported to VTK (r3.out.vtk).  VTK files can be visualized with the VTK Toolkit, Paraview and MayaVi.  GRASS 2D
       raster maps can be exported to VTK with r.out.vtk, GRASS vector maps can be exported to VTK with v.out.vtk.

       Alternatively, GRASS 3D raster maps can be imported and exported from/to Vis5D (r3.out.v5d).  Note that Vis5D is limited in the	number	of
       supported voxels.

       Finally, export to 3D ASCII is also available (r3.out.ascii).

   See also
       Introduction to GRASS raster map processing

       full index

       (C) 2008-2011 GRASS Development Team

GRASS 6.4.2														     raster3dintro(1grass)
All times are GMT -4. The time now is 11:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy