int main() { double x[1000] ; // double y[8000] ; // if storage is sufficient, source and destination // can be same array int i ; outS("enter a word : ") ; inS(x) ; outS(x) ; outS("_hello\n") ; // unpack(y, x) ; unpack(x, x) ; i = 0 ; // while (y[i] != 0) { y[i] += 2.0 ; i++ ; } while (x[i] != 0) { x[i] += 2.0 ; i++ ; } // pack(x, y) ; pack(x, x) ; outS(x) ; outS("_goodbye\n") ; }
void Map::load(QString dir) { QDir qDir(dir); qDir.mkpath(dir); if(dir[dir.size() - 1] != '\\') dir += '\\'; leftPopulation -> loadPopulation(dir + "LeftPopulation\\"); rightPopulation -> loadPopulation(dir + "RightPopulation\\"); QFile *fileX = new QFile(dir + "mapX.save"); QFile *fileY = new QFile(dir + "mapY.save"); QFile *fileS = new QFile(dir + "mapS.save"); if (! fileX -> open(QIODevice::ReadOnly | QIODevice::Text) || ! fileY -> open(QIODevice::ReadOnly | QIODevice::Text) || ! fileS -> open(QIODevice::ReadOnly | QIODevice::Text) ) { // Error while trying to read file } else { // Everything is OK QTextStream inX(fileX); QTextStream inY(fileY); QTextStream inS(fileS); inS >> minDeltaX; inS >> maxDeltaX; inS >> minDeltaY; inS >> maxDeltaY; inS >> lengthStartEnd; inS >> lengthTotal; int tmp_size; inX >> tmp_size; inY >> tmp_size; points.resize(tmp_size); for(int i = 0; i < points.size(); ++i) { inX >> points[i].x; inY >> points[i].y; } } fileX -> close(); fileY -> close(); fileS -> close(); updateLoseTimer(); }