A little experiment with custom sorting the result of a word frequency count using Google's Go language.

Member Avatar
Member Avatar
+2 forum 2

Again, calculate the minimum number of bills or coins required for a given amount of money (change). This time we will use a Go map instead of a csv string converted to a structure.

Member Avatar
+0 forum 0

Use Google's modern Go language (aka. golang) to convert a denary number (base 10) to a roman numeral. Just a good exercise to explore Go's map, slice, sort and for loop features. Note that in Go the **:=** is shorthand for assigning a type (by inference) and a value to a variable. A slice is like an array that can grow, and a map is a key indexed list. Go has only the for loop, but the syntax is very flexible and can accomplish all the usual loop duties.

Member Avatar
+2 forum 0

#ifndef _READFILE_H_ #define _READFILE_H_ #include<string> #include<vector> #include<map> using namespace std; class Readfile{ private: string str; vector <string> goArray; vector <string> strArray; vector <string> phyIntArray; vector <string> subArray; vector <string> proArray; /* member function */ void processString(string str); void processGoId(string); void processPhysicalInt(string); // void processMetabolicInt(string); public: typedef struct Info{ string uniprotID; vector <string> goId; vector <string> phyInt; }; map <int,struct Info> proteinData; map <int,struct Info>::iterator it; Readfile(string file);//constructor }; #endif

Member Avatar
Member Avatar
+1 forum 3

The End.