C++ (Qt)...// работа с файломunsigned mykey; int c; int t=0; QHash <int,QString> myHash; while(fgets(result_string,sizeof(result_string),file)){ i++; if(result_string[strlen(result_string)-1] == '\n'){ result_string[strlen(result_string)-1]='\0'; } c = strlen(result_string)-1; mykey = 1; while(c != -1){ if(c != 0 ) mykey = (mykey * toascii(result_string[c]) * c); else mykey = (mykey * toascii(result_string[c])); c --; } mykey = (mykey * strlen(result_string)) & 100000; while(myHash[mykey].isEmpty() == false){ //t++; //std::cout << "LOLOLOL"; QHash } std::cout<<"MyKey = " << mykey << " "; myHash[mykey] = result_string; std::cout << result_string <<"\n"; }std::cout << "Q = " << t << "\n";std::cout << i;
C++ (Qt)QString rs( result_string );myHash[ qHash( rs ) ] = rs;
C++ (Qt)QHash< QString, bool > myHash;myHash[ QString( result_string ) ] = true;
C++ (Qt)QHash <QString, QString> dictionary; // напр английское слово - ключ, русское - значение // или так если несколько вариантов переводаQHash <QString, QStringList> dictionary;
C++ (Qt)mySet.insert(rs);
// Here's an example QSet with QString values: QSet<QString> set;// To insert a value into the set, use insert(): set.insert("one"); set.insert("three"); set.insert("seven");// Another way to insert items into the set is to use operator<<(): set << "twelve" << "fifteen" << "nineteen";// To test whether an item belongs to the set or not, use contains(): if (!set.contains("ninety-nine"))