Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) PrimeExpert

 

PrimeExpert is a tool to determine if a number is prime.

 

 

 

 

 

Downloads

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolPrimeExpert/ToolPrimeExpertConsole.pro

 

# Go ahead and use Qt.Core: it is about as platform-independent as
# the STL and Boost
QT += core

# Go ahead and use Qt.Gui: it is about as platform-independent as
# the STL and Boost. It is needed for QImage
QT += gui

# Don't define widgets: it would defy the purpose of this console
# application to work non-GUI
#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

include(../../Classes/CppAbout/CppAbout.pri)
include(../../Classes/CppHelp/CppHelp.pri)
include(../../Classes/CppMenuDialog/CppMenuDialog.pri)
include(../../Classes/CppRichelBilderbeekProgram/CppRichelBilderbeekProgram.pri)
include(../../Classes/CppTrace/CppTrace.pri)
include(ToolPrimeExpertConsole.pri)

#
#
# Type of compile
#
#

CONFIG(release, debug|release) {
  DEFINES += NDEBUG NTRACE_BILDERBIKKEL
}

QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Weffc++

unix {
  QMAKE_CXXFLAGS += -Werror
}

#
#
# Boost
#
#

win32 {
  INCLUDEPATH += \
    ../../Libraries/boost_1_54_0
}

 

 

 

 

 

Qt project file: ./ToolPrimeExpert/ToolPrimeExpertDesktop.pro

 

include(../../DesktopApplicationNoWeffcpp.pri)
include(../../Libraries/Boost.pri)
include(../../Libraries/Fparser.pri)
include(../../Libraries/GeneralConsole.pri)
include(../../Libraries/GeneralDesktop.pri)

include(ToolPrimeExpertDesktop.pri)

SOURCES += qtmain.cpp

 

 

 

 

 

Qt project file: ./ToolPrimeExpert/ToolPrimeExpertWebsite.pro

 

include(../../Tools/Tool/ToolConsole.pri)

 

 

 

 

 

./ToolPrimeExpert/ToolPrimeExpertConsole.pri

 

INCLUDEPATH += \
    ../../Tools/ToolPrimeExpert

SOURCES += \
    ../../Tools/ToolPrimeExpert/primeexpert.cpp \
    ../../Tools/ToolPrimeExpert/primeexpertmenudialog.cpp

HEADERS += \
    ../../Tools/ToolPrimeExpert/primeexpert.h \
    ../../Tools/ToolPrimeExpert/primeexpertmenudialog.h

OTHER_FILES += \
    ../../Tools/ToolPrimeExpert/Licence.txt

 

 

 

 

 

./ToolPrimeExpert/ToolPrimeExpertDesktop.pri

 

include(../../Tools/ToolPrimeExpert/ToolPrimeExpertConsole.pri)

SOURCES += \
    ../../Tools/ToolPrimeExpert/qtprimeexpertmenudialog.cpp \
    ../../Tools/ToolPrimeExpert/qtprimeexpertmaindialog.cpp

HEADERS += \
    ../../Tools/ToolPrimeExpert/qtprimeexpertmenudialog.h \
    ../../Tools/ToolPrimeExpert/qtprimeexpertmaindialog.h

FORMS += \
    ../../Tools/ToolPrimeExpert/qtprimeexpertmenudialog.ui \
    ../../Tools/ToolPrimeExpert/qtprimeexpertmaindialog.ui

 

 

 

 

 

./ToolPrimeExpert/ToolPrimeExpertWebsite.pri

 

include(../../Tools/ToolPrimeExpert/ToolPrimeExpertConsole.pri)

SOURCES +=

HEADERS +=

 

 

 

 

 

./ToolPrimeExpert/main.cpp

 

//---------------------------------------------------------------------------
/*
PrimeExpert, tool to test if a number is prime
Copyright (C) 2008-2013 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolPrimeExpert.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include "toolprimeexpertmenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char *argv[])
{
  const std::vector<std::string> args { ribi::MenuDialog::ConvertArguments(argc,argv) };
  ribi::PrimeExpertMenuDialog d;
  return d.Execute(args);
}

 

 

 

 

 

./ToolPrimeExpert/primeexpert.h

 

//---------------------------------------------------------------------------
/*
PrimeExpert, class to calculate whether a number is prime
Copyright (C) 2008-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolPrimeExpert.htm
//---------------------------------------------------------------------------
#ifndef PRIMEEXPERT_H
#define PRIMEEXPERT_H

#include <string>
#include <vector>

namespace ribi {

struct PrimeExpert
{
  PrimeExpert();

  bool IsPrime(const int x);

  static std::string GetVersion() noexcept;
  static std::vector<std::string> GetVersionHistory() noexcept;

  private:
  std::vector<int> mPrimes;

  void CalculateNextPrime();
  int CalculateMax(const int x);
  friend std::ostream& operator<<(std::ostream&, const PrimeExpert&);

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif
};

std::ostream& operator<<(std::ostream& os, const PrimeExpert& primeExpert);

} //~namespace ribi

#endif // PRIMEEXPERT_H

 

 

 

 

 

./ToolPrimeExpert/primeexpert.cpp

 

//---------------------------------------------------------------------------
/*
PrimeExpert, class to calculate whether a number is prime
Copyright (C) 2008-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolPrimeExpert.htm
//---------------------------------------------------------------------------
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <iterator>
#include "primeexpert.h"

ribi::PrimeExpert::PrimeExpert()
  : mPrimes{}
{
  mPrimes.push_back(2);
}

void ribi::PrimeExpert::CalculateNextPrime()
{
  const int heighestKnownPrime = mPrimes.back();

  for (int i = heighestKnownPrime + 1; ;++i)
  {
    if (this->IsPrime(i)) { mPrimes.push_back(i); return; }
  }
}

int ribi::PrimeExpert::CalculateMax(const int x)
{
  return 1 + static_cast<int>(
    std::sqrt(static_cast<double>(x) ) );

}

std::string ribi::PrimeExpert::GetVersion() noexcept
{
  return "2.0";
}

std::vector<std::string> ribi::PrimeExpert::GetVersionHistory() noexcept
{
  return {
    "2008-07-12: Version 1.0: initial version in C++ Builder",
    "2011-02-26: Version 2.0: port to Qt Creator"
  };
}

bool ribi::PrimeExpert::IsPrime(const int x)
{
  assert(x > 2);
  //Calculate the maximum value for devision
  const int max = CalculateMax(x);

  assert(CalculateMax( 4) == 3); //When examining 4, divide (from 2) to 3
  assert(CalculateMax( 5) == 3);
  assert(CalculateMax( 6) == 3);
  assert(CalculateMax( 7) == 3);
  assert(CalculateMax( 8) == 3);
  assert(CalculateMax( 9) == 4); //When examining 9, divide (from 2) to 4
  assert(CalculateMax(10) == 4);
  assert(CalculateMax(11) == 4);
  assert(CalculateMax(12) == 4);
  assert(CalculateMax(13) == 4);
  assert(CalculateMax(14) == 4);
  assert(CalculateMax(15) == 4);
  assert(CalculateMax(16) == 5); //When examining 16, divide (from 2) to 5
  assert(CalculateMax(17) == 5);

  //Collect enough prime numbers to find if x is prime,
  //  if these are not yet present
  while ( mPrimes.back() < CalculateMax(x) )
    CalculateNextPrime();

  for (int i=0; ;++i)
  {
    assert( i < static_cast<int>(mPrimes.size() ) );
    const int knownPrime = mPrimes[i];
    if (knownPrime >= max) return true;
    if ( x % knownPrime == 0) return false;
  }

}

std::ostream& ribi::operator<<(std::ostream& os, const PrimeExpert& primeExpert)
{
  std::copy(
    primeExpert.mPrimes.begin(),
    primeExpert.mPrimes.end(),
    std::ostream_iterator<int>(os," ") );
  return os;
}

 

 

 

 

 

./ToolPrimeExpert/primeexpertmenudialog.h

 

#ifndef TOOLPRIMEEXPERTMENUDIALOG_H
#define TOOLPRIMEEXPERTMENUDIALOG_H

#include "menudialog.h"

namespace ribi {

struct PrimeExpertMenuDialog final : public MenuDialog
{
  About GetAbout() const noexcept override;
  Help GetHelp() const noexcept override;
  boost::shared_ptr<const Program> GetProgram() const noexcept override;
  std::string GetVersion() const noexcept override;
  std::vector<std::string> GetVersionHistory() const noexcept override;

  private:
  int ExecuteSpecific(const std::vector<std::string>& argv) noexcept override;

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif
};

} //~namespace ribi

#endif // TOOLPRIMEEXPERTMENUDIALOG_H

 

 

 

 

 

./ToolPrimeExpert/primeexpertmenudialog.cpp

 

#include "primeexpertmenudialog.h"

#include <cassert>
#include <iostream>

#include "richelbilderbeekprogram.h"
#include "testtimer.h"
#include "trace.h"

int ribi::PrimeExpertMenuDialog::ExecuteSpecific(const std::vector<std::string>& argv) noexcept
{
  #ifndef NDEBUG
  Test();
  #endif
  const int argc = static_cast<int>(argv.size());
  if (argc == 1)
  {
    std::cout << this->GetHelp() << '\n';
    return 1;
  }
  assert(!"TODO");
  return 1;
}

ribi::About ribi::PrimeExpertMenuDialog::GetAbout() const noexcept
{
  About a(
    "Richel Bilderbeek",
    "PrimeExpert",
    "prime look-up table",
    "the 11th of Oktober 2013",
    "2008-2015",
    "http://www.richelbilderbeek.nl/ToolPrimeExpert.htm",
    GetVersion(),
    GetVersionHistory()
  );
  a.AddLibrary("TestTimer version: " + TestTimer::GetVersion());
  a.AddLibrary("Trace version: " + Trace::GetVersion());
  return a;
}

ribi::Help ribi::PrimeExpertMenuDialog::GetHelp() const noexcept
{
  return Help(
    this->GetAbout().GetFileTitle(),
    this->GetAbout().GetFileDescription(),
    {

    }
    ,
    {

    }
  );
}

boost::shared_ptr<const ribi::Program> ribi::PrimeExpertMenuDialog::GetProgram() const noexcept
{
  const boost::shared_ptr<const ribi::Program> p {
    new ProgramPrimeExpert
  };
  assert(p);
  return p;
}

std::string ribi::PrimeExpertMenuDialog::GetVersion() const noexcept
{
  return "2.2";
}

std::vector<std::string> ribi::PrimeExpertMenuDialog::GetVersionHistory() const noexcept
{
  return {
    "2008-07-12: Version 1.0: initial version in C++ Builder",
    "2011-02-26: Version 2.0: port to Qt Creator",
    "2013-10-11: Version 2.1: conformized for ProjectRichelBilderbeek",
    "2013-11-04: Version 2.2: conformized for ProjectRichelBilderbeekConsole",
  };
}

#ifndef NDEBUG
void ribi::PrimeExpertMenuDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolPrimeExpert/qtmain.cpp

 

//---------------------------------------------------------------------------
/*
PrimeExpert, tool to test if a number is prime
Copyright (C) 2008-2013 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolPrimeExpert.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include <QApplication>
#include "qtprimeexpertmenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  ribi::QtToolPrimeExpertMenuDialog w;
  w.show();
  return a.exec();
}

 

 

 

 

 

./ToolPrimeExpert/qtprimeexpertmaindialog.h

 

//---------------------------------------------------------------------------
/*
PrimeExpert, tool to test if a number is prime
Copyright (C) 2008-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolPrimeExpert.htm
//---------------------------------------------------------------------------
#ifndef QTTOOLPRIMEEXPERTMAINDIALOG_H
#define QTTOOLPRIMEEXPERTMAINDIALOG_H

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include "qthideandshowdialog.h"
#include <boost/scoped_ptr.hpp>
#pragma GCC diagnostic pop

namespace Ui {
  class QtToolPrimeExpertMainDialog;
}

namespace ribi {

struct PrimeExpert;

class QtToolPrimeExpertMainDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtToolPrimeExpertMainDialog(QWidget *parent = 0);
  QtToolPrimeExpertMainDialog(const QtToolPrimeExpertMainDialog&) = delete;
  QtToolPrimeExpertMainDialog& operator=(const QtToolPrimeExpertMainDialog&) = delete;
  ~QtToolPrimeExpertMainDialog() noexcept;

private:
  Ui::QtToolPrimeExpertMainDialog *ui;
  boost::scoped_ptr<PrimeExpert> m_expert;

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif

private slots:
    void on_edit_value_textChanged(QString );
};

} //~namespace ribi

#endif // QTTOOLPRIMEEXPERTMAINDIALOG_H

 

 

 

 

 

./ToolPrimeExpert/qtprimeexpertmaindialog.cpp

 

//---------------------------------------------------------------------------
/*
PrimeExpert, tool to test if a number is prime
Copyright (C) 2008-2015 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolPrimeExpert.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include "qtprimeexpertmaindialog.h"

#include <boost/lexical_cast.hpp>
#include <boost/timer.hpp>

#include "about.h"
#include "qtaboutdialog.h"
#include "primeexpert.h"
#include "testtimer.h"
#include "trace.h"
#include "ui_qtprimeexpertmaindialog.h"
#pragma GCC diagnostic pop

ribi::QtToolPrimeExpertMainDialog::QtToolPrimeExpertMainDialog(QWidget *parent)
  : QtHideAndShowDialog(parent),
    ui(new Ui::QtToolPrimeExpertMainDialog),
    m_expert(new PrimeExpert)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
  ui->edit_value->setText("2");
}

ribi::QtToolPrimeExpertMainDialog::~QtToolPrimeExpertMainDialog() noexcept
{
  delete ui;
}

void ribi::QtToolPrimeExpertMainDialog::on_edit_value_textChanged(QString s)
{
  ui->text->clear();
  try
  {
    boost::lexical_cast<int>(s.toStdString());
  }
  catch (boost::bad_lexical_cast&)
  {
    ui->text->appendPlainText("NaN");
    return;
  }
  const int value = boost::lexical_cast<int>(s.toStdString());
  if (value < 2)
  {
    ui->text->appendPlainText("Not prime");
    return;
  }
  if (value == 2)
  {
    ui->text->appendPlainText("Prime");
    return;
  }
  const boost::timer t;
  const bool isPrime = m_expert->IsPrime(value);
  const double time = t.elapsed();
  const std::string text
    = std::string(isPrime ? "Prime" : "Not prime")
    + " ("
    + boost::lexical_cast<std::string>(time)
    + " sec)";
  ui->text->appendPlainText(text.c_str());
}

#ifndef NDEBUG
void ribi::QtToolPrimeExpertMainDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolPrimeExpert/qtprimeexpertmenudialog.h

 

#ifndef QTTOOLPRIMEEXPERTMENUDIALOG_H
#define QTTOOLPRIMEEXPERTMENUDIALOG_H

#include "qthideandshowdialog.h"

namespace Ui {
  class QtToolPrimeExpertMenuDialog;
}

namespace ribi {

class QtToolPrimeExpertMenuDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtToolPrimeExpertMenuDialog(QWidget *parent = 0);
  QtToolPrimeExpertMenuDialog(const QtToolPrimeExpertMenuDialog&) = delete;
  QtToolPrimeExpertMenuDialog& operator=(const QtToolPrimeExpertMenuDialog&) = delete;
  ~QtToolPrimeExpertMenuDialog() noexcept;

protected:
  
  void keyPressEvent(QKeyEvent *);

private:
  Ui::QtToolPrimeExpertMenuDialog *ui;

  #ifndef NDEBUG
  static void Test() noexcept;
  #endif

private slots:
  void on_button_about_clicked();
  void on_button_quit_clicked();
  void on_button_start_clicked();
};

} //~namespace ribi

#endif // QTTOOLPRIMEEXPERTMENUDIALOG_H

 

 

 

 

 

./ToolPrimeExpert/qtprimeexpertmenudialog.cpp

 

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#include "qtprimeexpertmenudialog.h"

#include <QDesktopWidget>
#include <QKeyEvent>

#include "primeexpertmenudialog.h"
#include "qtaboutdialog.h"
#include "qtprimeexpertmaindialog.h"
#include "qthideandshowdialog.h"
#include "testtimer.h"
#include "trace.h"
#include "ui_qtprimeexpertmenudialog.h"
#pragma GCC diagnostic pop

ribi::QtToolPrimeExpertMenuDialog::QtToolPrimeExpertMenuDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtToolPrimeExpertMenuDialog)
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
}

ribi::QtToolPrimeExpertMenuDialog::~QtToolPrimeExpertMenuDialog() noexcept
{
  delete ui;
}

void ribi::QtToolPrimeExpertMenuDialog::keyPressEvent(QKeyEvent * event)
{
  if (event->key() == Qt::Key_Escape) { close(); return; }
}

void ribi::QtToolPrimeExpertMenuDialog::on_button_about_clicked()
{
  About a = PrimeExpertMenuDialog().GetAbout();
  a.AddLibrary("QtHideAndShowDialog version: " + QtHideAndShowDialog::GetVersion());
  QtAboutDialog d(a);
  d.setWindowIcon(this->windowIcon());
  d.setStyleSheet(this->styleSheet());
  this->ShowChild(&d);
}

void ribi::QtToolPrimeExpertMenuDialog::on_button_quit_clicked()
{
  close();
}

void ribi::QtToolPrimeExpertMenuDialog::on_button_start_clicked()
{
  QtToolPrimeExpertMainDialog d;
  d.setStyleSheet(this->styleSheet());
  ShowChild(&d);
}

#ifndef NDEBUG
void ribi::QtToolPrimeExpertMenuDialog::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  const TestTimer test_timer(__func__,__FILE__,1.0);
}
#endif

 

 

 

 

 

./ToolPrimeExpert/zip.sh

 

#!/bin/sh
#zip packs all the files to port into a single .zip file,
#minicking the same folder structure
#Folder structure
# *
#   * Classes
#     * CppAbout
#     * CppPrimeExpert
#     * CppQtAboutDialog
#   * Tools
#    * ToolTestPrimeExpert
echo "Mimicking file structure"
mkdir temp_zip
mkdir temp_zip/Classes
mkdir temp_zip/Classes/CppAbout
mkdir temp_zip/Classes/CppPrimeExpert
mkdir temp_zip/Classes/CppQtAboutDialog
mkdir temp_zip/Tools
mkdir temp_zip/Tools/ToolTestPrimeExpert

echo "Copying files"
cp ../../Classes/CppAbout/*.* temp_zip/Classes/CppAbout
cp ../../Classes/CppPrimeExpert/*.* temp_zip/Classes/CppPrimeExpert
cp ../../Classes/CppQtAboutDialog/*.* temp_zip/Classes/CppQtAboutDialog
cp ../../Tools/ToolTestPrimeExpert/*.* temp_zip/Tools/ToolTestPrimeExpert

echo "Compressing files"
cd temp_zip

zip -r ToolTestPrimeExpertSource_2_0 Classes
zip -r ToolTestPrimeExpertSource_2_0 Tools

echo "Copying zipped file from temp folder to this folder"

cd ..
cp temp_zip/ToolTestPrimeExpertSource_2_0.zip ToolTestPrimeExpertSource_2_0.zip

echo "Cleaning up"
#Classes
rm temp_zip/Classes/CppAbout/*.*
rm temp_zip/Classes/CppPrimeExpert/*.*
rm temp_zip/Classes/CppQtAboutDialog/*.*
rmdir temp_zip/Classes/CppAbout
rmdir temp_zip/Classes/CppPrimeExpert
rmdir temp_zip/Classes/CppQtAboutDialog
rmdir temp_zip/Classes
#Tools
rm temp_zip/Tools/ToolTestPrimeExpert/*.*
rmdir temp_zip/Tools/ToolTestPrimeExpert
rmdir temp_zip/Tools
rm temp_zip/*.*
rmdir temp_zip
echo "Done"

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml