C++ (Qt) // А так - правильно int height; int width; char *nameOfThis; char *nameOfThat;
C++ (Qt)void MyList::scrollToNode( int index, bool selectIt );
C++ (Qt)void bulls_and_cows(int firstNumber, int secondNumber, int & numberOfBulls, int & numberOfCows) { // ... const std::size_t nsize = 4; std::vector<int> vec_first(nsize); std::vector<int> vec_second(nsize); // ...}
C++ (Qt)void CalcBullsCows( const TVector & v1, const TVector & v2, int & numBulls, int & numCows ){ for (size_t i = 0; i < v2.size(); ++i) { TVector:::const_iterator it = std::find(v1.begin(), v1.end(), v2[i]); if (it == v1.end()) continue; if (std::distance(v1.begin(), it) == i) ++numBulls; else ++numCows; } }
C++ (Qt)template <class Cont1, class Cont2>void CalcBullsCows( const Cont1 & v1, const Cont2 & v2, int & numBulls, int & numCows ){..}
C++ (Qt)int showError(int errorCode, const std::string& fileName) { switch (errorCode) { case 1: std::cerr << "Error: cannot open the file " << fileName.c_str() << std::endl; break; case 2: std::cerr << "Error: cannot write to the file " << fileName.c_str() << std::endl; break; case 3: std::cerr << "Error: incorrect data in the file " << fileName.c_str() << std::endl; break; default: std::cerr << "Error code: " << errorCode << "; file name: " << fileName.c_str() << std::endl; break; } return errorCode;}
C++ (Qt)enum ErrorType { errCannotOpenFile, errCannotWriteToFile, errIncorrectData}; //... int showError(int errorCode, const std::string& fileName) { switch (errorCode) { case ErrorType::errCannotOpenFile: std::cerr << "Error: cannot open the file " << fileName.c_str() << std::endl; break; case ErrorType::errCannotWriteToFile: std::cerr << "Error: cannot write to the file " << fileName.c_str() << std::endl; break; case ErrorType::errIncorrectData: std::cerr << "Error: incorrect data in the file " << fileName.c_str() << std::endl; break; default: std::cerr << "Error code: " << errorCode << "; file name: " << fileName.c_str() << std::endl; break; } return errorCode;}
C++ (Qt)QMAKE_CXXFLAGS += -std=c++11