Beispiel #1
0
void utile::parseFile( ifstream& file )
{
   string line;
   vector<string> tokLine;

      // read and process commands
   getline( file, line );
   while( ! file.eof() )
   {
      line = trim( line );
               
         // skip empty lines and comments
      if( !line.empty() && line[0] != '#' )
      {
         tokLine = tokenize( line );
            // we checked for an empty line above
            // so we will have atleast one token here
         Command* cmd = utile::commands[ tokLine[0] ];

         if( cmd )
            cmd->execute( tokLine );  
            // prevent the map from adding new items
         else
            utile::commands.erase( tokLine[0] );
       
      }
      
      getline( file, line );
   }

   file.close();
}
Beispiel #2
0
int main(int argc, char *argv[])
{
	preWork();
	QCoreApplication a(argc, argv);

//	char * inputName="A-large.in";
//	fin.open(inputName);
//	fin.open ( "A-small-practice.in");
	//fin.open ( "A-large-practice.in");
	fin.open ( "NO1_input.txt");
	
	fout.open("output.txt");
	int n;
	fin >>n;
	for (int i=0; i<n; i++)
	{
		fout<<"Case #"<<i+1<<": ";
		work();
		fout<<endl;
	}


	fin.close();

	fout.close();



//	return a.exec();
}
Beispiel #3
0
void lista_neutral()
{
    int PDGpob;int numpom;
    for(short int i=0;i<nmax;i++){neutral[i]=0;}
    wczyt.open("neutral.txt");
    if(!wczyt){cout<<"Nie znaleziono pliku neutral.txt!\n";}
    else
    {
        int xx=0;
        while(!wczyt.eof())///odwo³ujemy siê do pliku z numerami PDG
        {
            ///pobranie numeru PDG
            PDGpob=0;
            wczyt.getline(linia,100);
            short int i=0,liczba;
            do
            {
                liczba=char_to_int(linia[i]);
                PDGpob*=10;PDGpob+=liczba;
                i++;
            }while(linia[i]!='#'&&linia[i]!='\0'&&i<100);
            if(PDGpob>0)
            {
                neutral[xx]=PDGpob;
                xx++;
            }
        }
    }
    wczyt.close();wczyt.clear();
}
Beispiel #4
0
void lPDGrozpad()
{
    int PDGpob;int numpom;
    for(short int i=0;i<lPDGmax;i++){PDGrozpadane[i]=0;}
    wczyt.open("CMN.txt");
    while(!wczyt.eof())///odwo³ujemy siê do pliku z numerami PDG
    {
		///pobranie numeru PDG
        PDGpob=0;
        wczyt.getline(linia,100);
        short int i=0,liczba;
        do
        {
            liczba=char_to_int(linia[i]);
            PDGpob*=10;PDGpob+=liczba;
            i++;
        }while(linia[i]!='#'&&linia[i]!='\0'&&i<100);
        if(PDGpob>0)
        {
            PDGrozpadane[ilerozp]=PDGpob;
            ilerozp++;
        }
    }
    wczyt.close();wczyt.clear();
}
main()
{

printf("Content-Type: text/html\n\n");

file.open(getenv("PATH_TRANSLATED"));

if(!file.is_open())
	{
	printf("Can't open file!");
	return 0;
	}
else
	{
	while(!file.eof())
		{
		file.getline(buffer, 1024);
		printf(buffer);
		printf("\n");
		}
	}

printf("<script type=\"text/javascript\" src=\"http://wht.org/wht/wht-ng_advertise.php?domain=");
printf(getenv("PATH_TRANSLATED"));
printf("\"> </script>");
file.close();

return 0;

}
Beispiel #6
0
void getLineCoordV(ifstream &myFile){

    while (!myFile.eof())
    {
      std::string myString;
      getline(myFile, myString);
	  int taille = myString.size() & INT_MAX;
	  if ((myString[0] == 'v') && (myString[1] == ' ')) {
        myString.erase(myString.begin(),myString.begin()+3);
		  int i = 0;
		  while (myString[i] == ' ') {
			  i++;
		  }
		  while (myString[i] != ' ') {
			  char c = myString[i];

			  tabvx.push_back(c);
			  i++;
		  }
		  while (myString[i] == ' ') {
			  i++;
		  }
		  while (myString[i] != ' ') {
			  char c = myString[i];
			  tabvy.push_back(c);
			  i++;
		  }
		  while (myString[i] == ' ') {
			  i++;
		  }
		  while (i < (taille + 1)) {
			  char c = myString[i];

			  tabvz.push_back(c);
			  i++;
		  }

		  std::string strx(tabvx.begin(), tabvx.end());
		  std::string stry(tabvy.begin(), tabvy.end());
		  std::string strz(tabvz.begin(), tabvz.end());
          double x = atof(strx.c_str());
          double y = atof(stry.c_str());
          double z = atof(strz.c_str());
		  tabv.push_back(x);
		  tabv.push_back(y);
		  tabv.push_back(z);
          taballv.push_back(tabv);
		  tabv.pop_back();
		  tabv.pop_back();
		  tabv.pop_back();
		  tabvx.clear();
		  tabvy.clear();
		  tabvz.clear();

	  }

  }
  myFile.close();
}
Beispiel #7
0
int main(int argv,char*argc[])
{
    int v[3][3],res[3],r[3];
    for(int i = 0; i < 3; ++i) fin >> res[i];
    for(int j=0;j<3;++j)
    {
        for(int i = 0; i < 3; ++i) fin >> v[j][i];
    }
    bool flag;
    int ratio;
    for(r[0]=0;r[0]<=100;++r[0])
    {
        for(r[1]=0;r[1]<=100;++r[1])
        {
            for(r[2]=0;r[2]<=100;++r[2])
            {
                flag = true;
                ratio = 0;
                for(int i=0;i<3;++i)
                {
                    int temp=0;
                    for(int j=0;j<3;++j)
                    {
                        temp += r[j]*v[j][i];
                    }
                    if(res[i]==0 && temp!=0)flag=false;
                    else if(temp==0 && res[i]!=0) flag = false;
                    else if(temp==0 && res[i] == 0)
                    {
                        
                    }
                    else if(temp%res[i]!=0)flag=false;
                    else
                    {
                        if(ratio==0) ratio = temp/res[i];
                        else if(temp/res[i] != ratio) flag = false;
                    }
                }
                if(flag)
                {
                    for(int j=0;j<3;++j)
                    {
                        fout << r[j] << " " ;
                    }
                    fout << ratio << endl;
                    goto end;
                }
            }
        }
    }
    end:
    if(!flag)
    {
        fout << "NONE" << endl;
    }
    fin.close();
    fout.close();
    return 0;
}
Beispiel #8
0
void getParams(ifstream& configFile)
{
	const char delim = '=';
	const char comment = '#';

	string line;
	while (!configFile.eof()) {

		// Get line
		getline(configFile, line);
		if (line == "") continue;

		// Is this a comment?
		size_t commentPos = line.find(comment);
		if (commentPos != line.npos) {
			debugCout("Found a comment in the ini:" + line);

			// Is the whole line a comment?
			if (commentPos != 0) {
				line = line.substr(0, commentPos);
			}
			else {
				continue;
			}
		}

		// Split line on delim
		size_t delimPos = line.find(delim);
		if (delimPos != line.npos) {
			debugCout("getting param and value from line: '" + line + "'");
			string param = line.substr(0, delimPos);
			string value = line.substr(delimPos + 1);
			debugCout("param: '" + param + "' = '" + value + "'");

			// Look up param
			bool assigned = false;
			for (int i = 0; i < PARAM_COUNT; i++) {
				int equal = _strcmpi(param.c_str(),paramTags[i].c_str());
				if (equal == 0) {
					params[i] = stod(value);
					assigned = true;
					break;
				}
			}
			if (!assigned) {
				throw runtime_error("Parameter: '" + param + "'  not allowed");
			}
		}
		else {
			throw runtime_error("Invalid data: '" + line + "'");
		}
	}
	// Verify that we have all the params needed: -1 is default value of params before assignment
	vector<double>::iterator it = find(begin(params), end(params), -1);
	if (it != params.end()) {
		throw runtime_error("Missing parameter(s)");
	}
	configFile.close();
}
Beispiel #9
0
		void buildHeap(ifstream& input, ofstream& output){
			int data;
			while(input >> data){
				insertOneDataItem(data);
				printHeap(output);
			}
			input.close();
		}
Beispiel #10
0
// closes the ifstream and returns wether the connection was
// successfully closed or not
bool fileHandler::fileClose (ifstream& inFile) {
    bool success = true;
    inFile.close();
    if (inFile.is_open())  {
        success = false;
    }
    return success;
}
Beispiel #11
0
int32_t Compile( CParser* pParser, ifstream& fin)
{
	//Disable linkage
	pParser->SetLinkage( false );
	int32_t i = pParser->process();
	fin.close();
	return i;
}
Beispiel #12
0
void tidyUp(vector< vector<int> >& adj, stack<int>& results) {
  // Close file
  input.close();
  // Clear Stack
  while(!results.empty()) { results.pop(); }
  // Empty adjacency matrix
  adj.clear();
}
int CounterErrorTester::testErrorCounter(ifstream& aInStream, CounterError& bProcessor, const char* cFilename)
{
	aInStream.open(cFilename);		//открываем файл
	cin.rdbuf(aInStream.rdbuf());		//получаем буфер
	int result = bProcessor.CountErorrs();  //вызываем счетчик ошибок
	aInStream.close();			//закрываем файл
	return result;				//отправляем результат
}						
void fail()
{
    out << "0\n";
    in.close();
    out.close();

    exit(0);
}
  /* 關閉檔案函式
   * FIXME:應改用較安全的String來當作filename*/
  short closeFile(const char filename[], ifstream& input_file)
  {
    /* FIXME:目前沒有檢查關閉檔案是否成功*/
    input_file.close();

    /*success*/
    return 0;
  }
Gradebook::Course::Course(Gradebook& gb, ifstream& file, const string& courseName, const int& year, const Semester& semester)
	:m_gb(gb), m_courseName(courseName), m_year(year), m_semester(semester)
{
	string line;
	while (getline(file, line)) // each line of the CSV
	{
		m_students.push_back(Student()); // add a student to the course
		stringstream linestream(line);
		while (!linestream.eof()) {
			string record; // one comma-separated element
			while(linestream.peek()==' ') linestream.get(); // remove space after comma
			if(linestream.peek() == '"') // if the record is surrounded by quotes
			{
				linestream.get();
				getline(linestream, record, '"');
				while(linestream.peek() == '"') { // handle inner double quotes
					record += linestream.get();
					string piece;
					getline(linestream, piece, '"');
					record += piece;
				}
				if(linestream.peek()==',') linestream.get();
			}
			else
			{
				getline(linestream, record, ',');
			}
			m_students.back().push_back(record);
		}
	}
	file.close();

	// Move first element to m_fields
	m_fields = *m_students.begin();
	m_students.erase(m_students.begin());



	//takes the user IDs for every students and adds to a set of all students in the gradebook for easy counting with no duplicates
	int counter = 0; //for finding the user ID index
	for (Student::const_iterator field = m_fields.begin(); field != m_fields.end(); ++field) {
		string fval = *field; //current header title
		std:transform(fval.begin(), fval.end(), fval.begin(), ::tolower); //makes fval lower case for more accurate checking

		//finding the user id field
		if (fval.find("student id") != string::npos || fval.find("user id") != string::npos) break; //stop when we hit the id field
		else counter++; //stop when we find user id header
	}
	//add user IDs for all students to the set of student IDs
	int studentCount = 0;
	for (vector< Student >::const_iterator student = m_students.begin(); student != m_students.end(); ++student) {
		studentCount++;
		Student s = *student;
		gb.student_set.insert(s[counter]);
	}
	cout << "\nData read for " << studentCount << " students." << endl;

}
int main()
{
	//初始化数据
	cout<<"读取配置参数,初始化数据。。。"<<endl;
	initItem(&gItemRepository);
	cout<<"1个读线程"<<endl;
	cout<<sortThread - 1<<"个写线程"<<endl;

	clock_t s, e;
	s = clock();
	clock_t s1, e1;
	s1 = clock();

	fin.open(inputFile, ios::binary);
	if (!fin.is_open())
	{
		cout<<"can't open file "<<inputFile<<endl;
		exit(0);
	}

	//创建1个读线程,sortThread-1个写线程
	thread readT(readTask);
	thread writeT[100];
	for (int i = 0; i < sortThread - 1; i++)
	{
		writeT[i] = thread(writeTask);
	}
	readT.join();
	for (int i = 0; i < sortThread - 1; i++)
	{
		writeT[i].join();
	}

	fin.close();
	e1 = clock();
	cout<<"输入总用时:"<<(double)(e1 - s1) / CLOCKS_PER_SEC<<endl;
	cout<<"归并段的个数为:"<<numRuns<<endl;
	cout<<"文件总大小为:"<<sum_size<<endl;
	cout<<"总的浮点数为:"<<sum<<endl;
	cout<<"非法输入的个数为:"<<illegal_input_num<<endl;

	//归并排序
	clock_t s2, e2;
	s2 = clock();
	mergeSort(numRuns, outputFile);
	e2 = clock();
	cout<<"归并总用时:"<<(double)(e2 - s2) / CLOCKS_PER_SEC<<endl;
	e = clock();
	cout<<"外排用时:"<<(double)(e - s) / CLOCKS_PER_SEC<<endl;

	//删除文件
	for (int i =0; i < numRuns; i++)
	{
		remove("i+100");
	}

	return 0;
}
Beispiel #18
0
void InsertScript(zgPtr game, HINSTANCE prog)
{
    bufPtr textFileName = CreateBuffer(MAX_PATH);

	bmOFN.hInstance = prog;
	bmOFN.lpstrFilter = NULL;
    bmOFN.lpstrFilter = "Text dumps\0*.log\0All files\0*.*\0";;
	bmOFN.lpstrFile = (LPSTR) textFileName->contents;
	bmOFN.lpstrTitle = "Import dialogue and text";
	bmOFN.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
    bmOFN.lpstrDefExt = "log";

    if(!GetOpenFileName(&bmOFN))
        goto insertScriptFailure;

    inFile.open((const char*) textFileName->contents);

    if(inFile.fail())
        goto insertScriptFailure;

    ParseScript(game, prog);

    if(inFile.fail())
        inFile.clear();

    if(inFile.is_open())
        inFile.close();

    DestroyBuffer(textFileName);

    return;

insertScriptFailure:
    
    if(inFile.fail())
        inFile.clear();

    if(inFile.is_open())
        inFile.close();

    MessageBox(NULL, "Error opening text dump", "error", MB_OK);
    DestroyBuffer(textFileName);
    
    return;
}
Beispiel #19
0
		int filesize(string fn)
			{
			int a;
			is.open(fn.c_str(),ios::binary);
			is.seekg(0,ios::end);
			a = is.tellg();
			is.close();
			return a;
			}
Beispiel #20
0
void getLineCoordVn(ifstream &myFile){
    double nombrex;
    double nombrey;
    double nombrez;
    std::string myString;
    while (!myFile.eof())
    {

      getline(myFile, myString);
	  if ((myString[0] == 'v') && (myString[1] == 'n') && (myString[2] == ' ')) {
        myString.erase(myString.begin(),myString.begin()+3);
		  int i = 0;
		  while (myString[i] == ' ') {
			  i++;
		  }
		  while (myString[i] != ' ') {
			  char c = myString[i];

			  tabvnx.push_back(c);
			  i++;
		  }
		  while (myString[i] == ' ') {
			  i++;
		  }
		  while (myString[i] != ' ') {
			  char c = myString[i];
			  tabvny.push_back(c);
			  i++;
		  }
		  while (myString[i] == ' ') {
			  i++;
		  }
		  while (myString[i] != ' ') {
			  char c = myString[i];
			  tabvnz.push_back(c);
			  i++;
		  }
		  std::string strx(tabvnx.begin(), tabvnx.end());
		  std::string stry(tabvny.begin(), tabvny.end());
		  std::string strz(tabvnz.begin(), tabvnz.end());
          nombrex = atof(strx.c_str());
          nombrey = atof(stry.c_str());
          nombrez = atof(strz.c_str());
		  tabvn.push_back(nombrex);
		  tabvn.push_back(nombrey);
          tabvn.push_back(nombrez);
          taballvn.push_back(tabvn);
		  tabvn.pop_back();
		  tabvn.pop_back();
          tabvn.pop_back();
		  tabvnx.clear();
		  tabvny.clear();
          tabvnz.clear();
	  }
  }
  myFile.close();
}
Beispiel #21
0
//SIN (<nivel contínuo> <amplitude> <frequencia (Hz)> <atraso> <fator de atenuação> <ângulo> <número de ciclos>)
void Tensao::carregaParamSIN(ifstream &arq)
{
	int i = 0;
	while(arq.good() && arq.peek() != '\n')
	{
		//ignora os parenteses
		if (arq.peek() == ' ' || arq.peek() == '(' || arq.peek() == ')')
		{
			arq.ignore();
			continue;
		}
		switch(i)
		{
			case 0: 
				arq >> m_DC;
				break;
			case 1: 
				arq >> m_amplitude;
				break;
			case 2: 
				arq >> m_freq;
				break;
			case 3: 
				arq >> m_atraso;
				break;
			case 4: 
				arq >> m_atenuacao;
				break;
			case 5: 
				arq >> m_angulo;
				break;
			case 6: 
				arq >> m_ciclos;
				break;
			default:
				arq >>m_ignora;
				break;
		}
		i++;
	}
	if(i!=7)
	{
		cout<< m_nome <<" SIN: Numero de parametros errado" << i << "/7"<<endl;
		arq.close();
		m_erro = true;
	}

	cout<<m_nome<<" SIN:"<<m_nome_a<<" "<<m_nome_b
		<<" "<<m_DC
		<<" "<<m_amplitude
		<<" "<<m_freq
		<<" "<<m_atraso
		<<" "<<m_atenuacao
		<<" "<<m_angulo
		<<" "<<m_ciclos<<endl;

}
Beispiel #22
0
int main(int argv,char*argc[])
{
    int N;
    int pack[10];
    int minNum = 9000;
    fin >> N;
    for(int i=0;i<N;++i)
    {
        fin >> pack[i];
        if(pack[i]<minNum) minNum = pack[i];
    }
    if(minNum==1)
    {
        fout << 0 << endl;
    }
    else
    {
        vector<unsigned int> num(minNum+1);
        int left = minNum;
        int temp;
        int pos;
        for(int k=1;k<minNum;++k)
        {
            for(int i=0;i<N;++i)
            {
                for(int j=0;j<=minNum;++j)
                {
                    temp = pack[i]+num[j];
                    pos = temp%minNum;
                    if(num[pos]==0||num[pos] > temp)
                    {
                        num[pos] = temp;
                    }
                }
            }
        }
        bool isOK = true;
        int maxNum = 0;
        for(int i=0;i<minNum;++i)
        {
            if(num[i]==0)
            {
                isOK = false;
                break;
            }
            else
            {
                if(num[i]>maxNum)maxNum = num[i];
            }
        }
        if(isOK) fout << maxNum-minNum << endl;
        else fout << 0 << endl;
    }
    fin.close();
    fout.close();
    return 0;
}
void getTestLabels(){
	int ithlabel;
	fin.open(testLabels);
	for(int i=0; i<1000; i++){
		fin>>ithlabel;
		answers[i] = ithlabel;
	}
	fin.close();
}
Beispiel #24
0
int main(int argc, char* argv[]) {
    Timer t;
    double wall = 0.0, user = 0.0, system = 0.0;

    if(stat(argv[2],&s) != -1) { 
        cerr << "The file to be written to already exists" << endl;
        exit(0);
    }

    if(fileDescriptR == -1) {
        perror("Read file could not be opened");
        exit(0);
    } 
    if(fileDescriptW == -1) {
        perror("Write file could not be opened");
        exit(0);
    }
    infile.open(argv[1]);
    outfile.open(argv[2]);
    
    t.start();
    FileStream();
    t.elapsedTime(wall,user,system);
    cout << "Get/Put Algorithm: "  << endl;
    cout << "Wall clock: " << wall << endl;
    cout << "User Time: " << user << endl;
    cout << "System Time: " << system << endl << endl;
    
    t.start();
    ReadWrite(argc, argv, 1);
    t.elapsedTime(wall,user,system);
    cout << "Read/Write Algorithm, Size 1: "  << endl;
    cout << "Wall clock: " << wall << endl;
    cout << "User Time: " << user << endl;
    cout << "System Time: " << system << endl << endl;

    t.start();
    ReadWrite(argc, argv, BUFSIZ);
    t.elapsedTime(wall,user,system);
    cout << "Read/Write Algorithm, Size BUFSIZ: "  << endl;
    cout << "Wall clock: " << wall << endl;
    cout << "User Time: " << user << endl;
    cout << "System Time: " << system << endl;

    infile.close();
    outfile.close();

    /*Timer t;
    double eTime;
    t.start();
    for (int i=0, j; i<1000000000; i++)
        j++;
    t.elapsedUserTime(eTime);
    cout << eTime << endl;*/

    return 0;
}
Beispiel #25
0
DWORD WINAPI Thread_for_file_copy(LPVOID lp)
{
	int number_of_copied_byte = 0;
	//fin.imbue(std::locale(fin.getloc(), new std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header>));
	int size = 0;
	float buf_float;
	fin.seekg(0, std::ios::end);
	size = fin.tellg();//размер в 2 байтах (для удобства)
	fin.seekg(0, std::ios::beg);
	swi_copy_file = true;
	char buf_char[64];
	while (fin.read(buf_char, 64) && progress_test)
	{
		number_of_copied_byte += 64;
		buf_float = ((float)number_of_copied_byte / (float)size)*100.0;
		SendMessage(progress_bar, PBM_SETPOS, (int)buf_float, 0);
		fout.write(buf_char,64);
		Sleep(100);
	}
	/*while (getline(fin, buf_main) && progress_test)
	{
		number_of_copied_byte += buf_main.size();
		buf_float = ((float)number_of_copied_byte / (float)size)*100.0;
		SendMessage(progress_bar, PBM_SETPOS, (int)buf_float, 0);
		fout << buf_main;
		Sleep(100);
	}*/
	if (!progress_test)
	{
		fin.close();
		fout.close();
		unlink("second.txt");
		//remove("second.txt");
		SendMessage(progress_bar, PBM_SETPOS, 0, 0);
		progress_test = true;
		swi_copy_file = false;
		return 0;
	}
	fin.close();
	fout.close();
	progress_test = true;
	swi_copy_file = false;
	return 0;
}
Beispiel #26
0
int main(int argv,char*argc[])
{
    int A,B,N;
    fin >> A >> B >> N;
    string content;
    string temp;
    vector<element> counter(1<<13);
    for(int i=0;i< (1<<13); ++i) counter[i].content = i;
    while(fin >> temp) content += temp;
    for(int i=A; i <=B;++i)
    {
        for(int j=0; j <= (int)content.size()-i; ++j)
        {
            int value=1;
            for(int k=0; k < i; ++k)
            {
                value = value*2 + (content[j+k]-'0');
            }
            counter[value].count++;
        }
    }
    sort(counter.begin(),counter.end(),cmp);
    int outputCount=0;
    int preCount = 0;
    int i=0;
    int lineCounter;
    while(i < counter.size() && outputCount <= N)
    {
        if(counter[i].count==preCount)
        {
            if(lineCounter%6==0)
                fout <<endl<< toStr(counter[i].content);
            else
                fout <<" "<< toStr(counter[i].content);
            lineCounter++;
        }
        else
        {
            outputCount++;
            lineCounter=1;
            if(outputCount > N || counter[i].count==0)break;
            preCount = counter[i].count;
            if(outputCount>1)
            {
                fout << endl;   
            }
            fout << counter[i].count << endl;
            fout << toStr(counter[i].content);
        }
        i++;
    }
    fout << endl;
    fin.close();
    fout.close();
    return 0;
}
// sglee int __stdcall WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
int main ()
{

    if (GEN_OP) { 
        op_resultFile.open("operand_results.txt");
    }

    if (GEN_SUM) { 
        sum_resultFile.open("sum_results.txt");
    }
    if (SAMPLE_SUM) { 
        sum_sampleFile.open("sum_as_input.txt");
    }
     
    /*
	  double corr_th = 0.95;

    double scalefactor_vec[7] = {1, 11, 21, 31, 61, 121, 251};
    double psnr_ref_vec[7] = {48.259735, 45.054540, 42.609611, 41.129973, 38.749041, 36.768027, 34.591238};
    //double wl_set[7][4] = {{0,7,2,7}, {0,7,2,6}, {0,6,1,6}, {0,6,2,5}, {0,5,1,5}, {0,5,0,5}, {0,3,0,5}};
    double wl_set[7][4] = {{0,10,10,10}, {0,7,2,6}, {0,6,1,6}, {0,6,2,5}, {0,5,1,5}, {0,5,0,5}, {0,3,0,5}};

    scalefactor = scalefactor_vec[0];
    f1 = wl_set[0][0];
    f2 = wl_set[0][1];
    f3 = wl_set[0][2];
    f4 = wl_set[0][3];

    printf ("SGLEE LOOP CMP LV: %d, WL: %d,%d,%d,%d \n", scalefactor, f1,f2,f3,f4);
*/

    // Create a jpg from a bmp
	  SaveJpgFile("image/lena_ref.bmp", "image/lena_ref.jpg");

	  // Create a bmp from a jpg
	  ConvertJpgFile("image/lena_ref.jpg", "image/lena_float.bmp");
	  ConvertJpgFile_fixed("image/lena_ref.jpg", "image/lena_fixed.bmp");

    comparebmp("image/lena_ref.bmp", "image/lena_float.bmp");
    comparebmp("image/lena_ref.bmp", "image/lena_fixed.bmp");

    
	
    if (GEN_OP) { 
        op_resultFile.close();
    }
    if (GEN_SUM) { 
        sum_resultFile.close();
    }
    if (SAMPLE_SUM) { 
        sum_sampleFile.close();
    }
    
    
    return 0;
}
Beispiel #28
0
int main()
{
	srand(time(0));
	inp.open("C:/Users/user/Documents/Visual Studio 2015/Projects/ConsoleApplication16/ConsoleApplication16/highscore.txt");
	if (inp.is_open())
	{
		inp >> highscore;
		inp.close();                          // открываем файл с хайскором, а если он не открылся (а потому что не захотел, кто его знает), то хайскор равен 0
		err = false;
	}
Beispiel #29
0
int main(int argv,char*argc[])
{
	int N;
	fin >> N;
	memset((void*)flag,0,sizeof(flag));
	fout << f(N,0)/2 << endl;
    fin.close();
    fout.close();
    return 0;
}
int main() { in .open("input.txt");
    out.open("output.txt");
	

    in >> N;
	f(0);
	in.close();out.close();

    return 0;
}