Skip to content

Instantly share code, notes, and snippets.

View GermanHoyos's full-sized avatar
😋
Coding!

German Adrian Hoyos GermanHoyos

😋
Coding!
View GitHub Profile
@GermanHoyos
GermanHoyos / ArcMath.cpp
Created January 13, 2022 01:17
Program to find diameter / area / circumfrance - of a circle in C++
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <cmath>
@GermanHoyos
GermanHoyos / FindVowels.cpp
Created January 13, 2022 01:13
Program to find all vowels in a string C++
#include <iostream>
#include <string>
using namespace std;
bool isVowel(char range);
int main() {
string usrInpt;
@GermanHoyos
GermanHoyos / TypeCasting.cpp
Created January 13, 2022 01:08
Type Casting Example in C++
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main() {
int num;
@GermanHoyos
GermanHoyos / ifstream.cpp
Created January 13, 2022 01:06
Working with File IO in C++
//File I/O in 5 steps
#include <iostream>
#include <string>
#include <fstream> //Step 1)Include the header file fstream in the program.
#include <iomanip>
using namespace std;
** Invoke db:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke db:check_protected_environments (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config
** Execute db:check_protected_environments
** Execute db:drop
@GermanHoyos
GermanHoyos / bloccit-rails-console-assignment.txt
Created April 12, 2018 18:19
bloccit-rails-console-assignment
[14] pry(#<Post>):1> nesting
Nesting status:
--
0. main (Pry top level)
1. #<Post>
[15] pry(#<Post>):1> self.title = "my new title"
=> "my new title"
[16] pry(#<Post>):1> self.body = "My new body"
=> "My new body"
[17] pry(#<Post>):1> save!
@GermanHoyos
GermanHoyos / TwoDee.html
Created April 6, 2018 00:13
2d shooter foundation code
<html>
<head>
<style>
body {
background-color: #1f1f2e;
margin: 0px;
padding: 0px;
}
#gameConsole {
@GermanHoyos
GermanHoyos / Each With Index
Created March 4, 2018 00:04 — forked from PamBWillenz/Each With Index
Loops - Bloc Checkpoint
INSTRUCTIONS
[2,4,6].each_with_index do |element, index|
p "#{element} is at position #{index}"
end
Write a method, add_value_and_index, that takes an array of numbers and returns a new array composed of the value-plus-the-index of each element in the argument array:
add_value_and_index([2,4,6])
#=> 2,5,8
SPECS
class BankAccount
attr_reader :balance, :number_of_withdrawals
def initialize(balance) #constructor
@balance = balance
@number_of_withdrawals = 0
end
def display_balance
@balance
=begin
Define a class called CheckingAccount that inherits from BankAccount.
Write it so that if more than 3 withdrawals are made, it charges a $5
fee for each transaction afterwards. Use a constant called
MAX_FREE_WITHDRAWALS to set the maximum number of withdrawals before the
fee kicks in. Define a method called get_free_withdrawal_limit to expose
the value of the constant. If there aren't enough funds to cover the fee
and the limit has been reached, it should not make a successful
withdrawal. The class should also have a transfer method that uses an
account to move money from, and an amount to transfer as arguments and