Skip to content

Instantly share code, notes, and snippets.

@0x000000AC
0x000000AC / FractionArithmetic.cpp
Last active December 16, 2015 11:39
Arithmetic Operations on Factions
#include <iostream>
using namespace std;
enum MenuSelectionEnum
{
MENU_NONE = 0,
MENU_ADD = 1,
MENU_SUBTRACT = 2,
MENU_MULTIPLY = 3,
MENU_DIVIDE = 4,
@0x000000AC
0x000000AC / Rational.h
Created April 27, 2013 14:32
Fraction header
// prevent multiple inclusions of header file
#include <iostream>
#ifndef RATIONAL_H
#define RATIONAL_H
using namespace std;
class Rational
{
public:
@0x000000AC
0x000000AC / RationalDriver.cpp
Created April 27, 2013 14:36
Driver to go with Rational.h
#include <iostream>
#include "Rational.h"
using namespace std;
enum MenuSelectionEnum
{
MENU_NONE = 0,
MENU_ADD = 1,
MENU_SUBTRACT = 2,
MENU_MULTIPLY = 3,
@0x000000AC
0x000000AC / ReverseIntWhile.c
Created June 8, 2015 03:07
Reversing an Int in a While() loop
#include <stdio.h>
int main(void)
{
int number, right_digit;
printf ("Enter your number.\n");
scanf ("%i", &number);
while ( number != 0 )
.LC0:
.string "ay"
.LC1:
.string "\nThis is the substring: %s\n"
.LC2:
.string "The first character of the word is %s\n"
.LC3:
.string "AyEnding: %s\n"
.LC4:
.string "Your word in Pig Latin is %s\n"
/*
Pig Latin Translator 0.6
User Enters a word after the prompt
and gets the "Pig Latin" version back at the
prompt.
Compilation: #cc pigLatin.c -o pigLatinProgram
Execution: #./pigLatinProgram
/*
Pig Latin Translator 0.8
User Enters a word after the prompt
and gets the "Pig Latin" version back at the
prompt.
Example Compilation and Run
Apoh:Documents apoh$ cc pigLatinTranslator.c -o pigLatin
Apoh:Documents apoh$ ./pigLatin
/*
Pig Latin Translator 0.8.2
User Enters a word after the prompt
and gets the "Pig Latin" version back at the
prompt.
Example Compilation and Run
Apoh:Documents apoh$ cc pigLatinTranslator.c -o pigLatin
Apoh:Documents apoh$ ./pigLatin
Please enter a word.
import java.util.Scanner;
public class Atm
{
public static void main(String[] args)
{
double balance = 100.00;
double withdrawalAmount;
double depositAmount;
import java.util.Scanner;
public class Atm
{
public static void main(String[] args)
{
double balance = 100.00;
double withdrawalAmount;
double depositAmount;
boolean sentinelValue = true;