Search Results

Search found 3 results on 1 pages for 'enetik'.

Page 1/1 | 1 

  • C++ map to track when the end of map is reached

    - by eNetik
    Currently I have a map that prints out the following map<string, map<int,int> > mapper; map<int,int>::iterator inner; map<string, map<int,int> >::iterator outer; for(outer = mapper.begin(); outer != mapper.end(); outer++){ cout<<outer->first<<": "; for(inner = outer->second.begin(); inner != outer->second.end(); inner++){ cout<<inner->first<<","<<inner->second<<","; } } As of now this prints out the following stringone: 1,2,3,4,6,7,8, stringtwo: 3,5,6,7, stringthree: 2,3,4,5, What i want it to print out is stringone: 1,2,3,4,6,7,8 stringtwo: 3,5,6,7 stringthree: 2,3,4,5 how can i check for the end of the map inside my inner map? Any help would be appreciated Thank you

    Read the article

  • How to fill a two Dimensional ArrayList in java with Integers?

    - by eNetik
    I have to create a 2d array with unknown size. So I have decided to go with a 2d ArrayList the problem is I'm not sure how to initialize such an array or store information. Say I have the following data 0 connects 1 2 connects 3 4 connects 5 ....etc up to a vast amount of random connections and I want to insert true(1) into [0][1], true(1) into [2][3], true(1) into [4][5]. Can the array automatically update the column/rows for me Any help is appreciated thanks

    Read the article

  • need help with C++ using maps to keep track of words in a INPUT file

    - by eNetik
    Let say i have a text file with today is today but tomorrow is today tomorrow then using maps how can i keep track of the words that are repeated? and on which line it repeats? so far i have each string in the file read in as a temp and it is stored in the following way: map<string,int> storage; int count = 1 // for the first line of the file if(infile.is_open()){ while( !infile.eof() ){ getline(in, line); istringstream my_string(line); while(my_string.good()){ string temp; my_string >> temp; storage[temp] = count } count++;// so that every string read in the next line will be recorded as that line. } } map<string,int>::iterator m; for(int m = storage.begin(); m!= storage.end(); m++){ out<<m->first<<": "<<"line "<<m->second<<endl; } right now the output is just but: line 1 is: line 2 today: line 2 tomorrow: line 2 But instead.. it should print out(no repeating strings): today : line 1 occurred 2 times, line 2 occurred 1 time. is: line 1 occurred 1 time, line 2 occurred 1 time. but: line 1 occurred 1 time. tomorrow: line 2 occurred 2 times. Note: the order of the string does not matter. Any help would be appreciated. Thanks.

    Read the article

1