Skip to content

Instantly share code, notes, and snippets.

View lnrsoft's full-sized avatar
🎯
Focusing

lnrsoft lnrsoft

🎯
Focusing
View GitHub Profile
@lnrsoft
lnrsoft / evenOrOdd.cpp
Last active January 21, 2017 21:33
There is a simple method to determinate whether a number is even or odd in C++
// This source code written by Roland Ihasz
#include<iostream>
using namespace std;
bool evenOrOdd(int integer)
{
if (integer % 2==0)
return true;
else
return false;
@lnrsoft
lnrsoft / fibonacci.cpp
Last active January 22, 2019 13:10
Here is my C++ program to generate Fibonacci series
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <fstream>
#include <limits.h>
using namespace std;
int main()
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
int randint(int min, int max){
srand(static_cast<unsigned int>(time(0)));
return (min < max) ? ((rand() % ((max+1)-min)) + min) :
@lnrsoft
lnrsoft / factorize.cpp
Last active January 21, 2017 21:38
Number Factorizer. Enter a number to factorize.
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
vector <int> factorial;
@lnrsoft
lnrsoft / boostLibTest.cpp
Created July 2, 2014 22:47
Testing your Boost C++ libraries installation. Running the sample code that using the date_time Boost C++ library.
// This source code written by Roland Ihasz
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
using namespace std;
int main()
{
using namespace boost::gregorian;
@lnrsoft
lnrsoft / inheritance.cpp
Created July 13, 2014 20:11
This simple example consists of an overview of the syntax of inheritance in C++
// This source code written by Roland Ihasz
#include <iostream>
#include <string>
using namespace std;
class Animals { //base class
private:
string name;
int lifespan;
@lnrsoft
lnrsoft / polymorphism.cpp
Created July 13, 2014 20:36
This simple example consists of an overview of the syntax of Polymorphism and practical use of Virtual Destructor in C++
// This source code written by Roland Ihasz
#include <iostream>
using namespace std;
// base class
class GPSCoordinates {
protected:
double latitude, longitude;
string name;
public:
@lnrsoft
lnrsoft / pointers.cpp
Created July 17, 2014 23:02
How to create and delete pointers
// This source code written by Roland Ihasz
#include <iostream>
using namespace std;
int main()
{
int* MyPointer = nullptr; // new pointer declared
MyPointer = new int[3]; // memory dynamically allocated
@lnrsoft
lnrsoft / factorize.cpp
Created July 27, 2014 10:34
Number Factorizer. Enter a number to factorize. (long double)
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <iomanip> // std::setprecision
using namespace std;
int main()
{
@lnrsoft
lnrsoft / absolutePath.py
Last active January 21, 2017 21:37
Determinate the absolute path of a file in Python
import os
def getcurrentloc(fileName):
isfile = os.path.isfile(fileName)
notfound = (str(fileName) + " does not exist")
if isfile: # if (True) file exist return the path
return os.path.abspath(fileName)
else:
print notfound