Archive for the ‘Programming’ Category

Using xcopy for backing up files and folders

Monday, July 11th, 2016

If you want to backup a specific folder and do not want to use backup software there is always the xcopy command. Xcopy is primarily used to back up files and folders across a network to a specified device. This example is how to back up a folder on the network to a thumb drive on a server. (more…)

Linux, CentOS, Redhat G++ compiler and rand() / random function

Tuesday, November 18th, 2014

If you are using the G++ compiler in Linux, CentOS, or Redhat there are a couple of steps to adding a random number generator to any project.

  1. Include the precompile library: #include <stdlib.h>
  2. Use the function and add seeding: first_number = rand()%6 +1);

The basic function in C++ for the G++ compiler in Linux looks like this:

#include <iostream>

#include <stdlib.h>

int main()

{

int first_number = rand()%6 +1;

std::cout << first_number;

return (0);

}

Starting a console application in Microsoft Visual C++ 2010 Express

Tuesday, November 11th, 2014

Starting a Microsoft Visual C++ Studio Console Application

  1. Open Microsoft Visual C++ 2010 Express
  2. In the menu go to File – New – Project
  3. Click on Visual C++ and highlight Win32 Console Application
  4. Give the new project a name, default directory, and Solution Name
  5. Click OK and another GUI will pop-up
  6. On the Welcome to the Win32 Application Wizard click Next >
  7. On the Application Settings remove the check box from Precompiled Header and check Empty
  8. Click Finish
  9. When the new project opens right click on Source Files
  10. Go to AddNew Item…
  11. When the wizard opens highlight C++ File (.cpp) and give it the name of main.cpp
  12. Click Add
  13. Enter the following in the main.cpp file

          #include <iostream>

           int main()

{

               return 0;

}

Place your code after the first curly brace and before the return 0; to get started. Happy coding.

 

c++ lack jacks game for beginners in cmpsc 121

Tuesday, October 1st, 2013

This is a beginners game of lackjacks that does not use any functions, arrays, or pointers. This is an excellent project to get to know the basics of C++ since you will be using variables, conditional statements, loops, and basic console I/O (input/output). This is a Windows 32 bit console application, so you should be able to paste this code into a blank project that you added a source page.

(more…)

C# Methods using temperature conversion fahrenheit and celcius

Wednesday, January 16th, 2013

/*This is a console application to introduction to methods.

Every program requires a heading, which is below. The fields

will vary according to the class or organization you are

creating this program. For this class we will use temperature

conversions.
(more…)

Perl: Random dice game using array, case, and for Windows with Perl installed

Sunday, March 4th, 2012

I had a bit of free time, so I created this craps game for Windows. You can also run it on Linux and Unix by changing the path to where your Perl is located on the system. The application uses variable, a pre-defined array length, functions, and a do – while loop with a sentinal value to terminate the loop.
(more…)

C# Create Class with Properties for the temperature conversion Celcius and Fahrenheit

Sunday, February 26th, 2012

Here is the main program:

/*This is a console application to introduction to classes. Every program requires a heading, which is below. The fields will vary according to the class or organization you are creating this program. For this class we will use temperature conversions.
(more…)

C# Variable Basics Using Temperature Conversion Fahrenheit and Celsius

Sunday, February 26th, 2012

Here is a brief introduction to variable within C#.  We will be using temperature conversions to demonstrate variable declaration, usage, and formatting. Simply copy and paste the code into any new Microsoft Visual C# console application and you should be good to run this application.

/*This is a console application to introduction to variables.

Every program requires a heading, which is below. The fields

will vary according to the class or organization you are

creating this program. For this class we will use temperature

conversions.
(more…)