Hello. I am a novice programmer. I'm trying out small scale projects... Hopefully this ends well
Don't wanna be here? Send us removal request.
Photo
Itâs weird, sometimes when you program you delete ~100 lines of code because you realized youâre a bad programmer, your code wonât work, and you felt like destroying something beautiful
0 notes
Text
16, 37, 47, 57 - String Manipulation
16 - Split String into tokens delimited by one ore more separators
17 - Palindrome Checker,
47 - Words in a String,
57 - Anagram Checker,
0 notes
Text
10 - Word Wrapping
This one definitely falls under the âReally simple, but I spent more than an hour trying to get the logic right because you take for granted how difficult word wrapping isâ category (Kind of narrow, but trust me, it pops up more than youâd think)
https://github.com/CubicProgramming/ProgrammingChallenges/blob/master/10%20-%20WordWrapping.cpp
The trick here was to realize what you need for a word to be hyphenated (it must not be followed by a space), and realizing where you needed to check for that condition was the (width-1) index of the String
0 notes
Text
97 - Collatz Conjecture
https://github.com/CubicProgramming/ProgrammingChallenges/blob/master/97-Collatz.cpp
0 notes
Text
85 - Fibonacci
85) Fibonacci Sequence (at least 100 numbers)
Alright, so I know what youâre thinking... 6 KB for a Fibonacci implementation? Isnât that a bit excessive? Well... Yes and no. While only about ten lines of code at the most are needed for a working Fibonacci function, the real challenge of this program was going beyond the hundredthâ Fibonacci number.
Because around the 95th number, the actual value goes beyond 2^64 -1, the largest number possible in the existing data types, I had to sort of re-invent the wheel. I used the vector data structure because it allows for a dynamic, volatile number of entries. But I wasnât really content with using the decimal system, as that would waste significant space, so I used base-16 (hexadecimal) for addition operations, which was an incredible learning experience.
0 notes
Text
83 - Hangman
Hangman
Iâd place the difficulty programming this between the 15-piece sliding puzzle and Tic Tac Toe... It wasnât actually that difficult implementing the checks, just a bit time-consuming checking everything worked.
0 notes
Text
Challenge 71-Luhn Algorithm
The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in the US, and Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn
LuhnAlgorithm.cpp
Nothing too major, but this algorithm was kind of fun in seeing all the different implementations that existed
0 notes
Text
Challenges 70 and 80
  70) Reverse a Number Mathematically (ie 48572 => 27584)   80) Factorial
Other than the Algebra II/Pre-Calculus involved, there wasnât much to this challenge other than knowing how doubles and logarithms worked. The recursion on the factorial was fun, though.
0 notes
Text
69 - Reverse Polish Notation
This one was actually kind of difficult, not gonna lie.
RPN.cpp
If you donât know, Reverse Polish Notation (RPN), is a way of writing mathematical expressions where the operators go after the operands (eg. 3 4 + is 7, in other words, 3 4 + = 3 + 4). The hardest part was knowing how to handle the spaces between numbers in conjunction with processing the operators, as well as implementing a âwhileâ loop that would âsolveâ the equation.
0 notes
Text
Challenge 61 - 15 Piece Sliding Puzzle
15 Piece Sliding Puzzle.cpp
A definite step up in difficulty from the Tic-Tac-Toe program, the 15 Piece sliding puzzle is still at a level where it shouldnât give programmers knowledgeable about arrays much issue.
The reason this is more challenging than the Tic-Tac-Toe program is that, because this puzzle could theoretically go on forever, thereâs no way to hard-code every single possible state (and yes, someone actually hard-coded Tic-Tac-Toe... Itâs extremely painful: https://github.com/asweigart/my_first_tic_tac_toe/blob/master/tictactoe.py), so actual thought is required on this front.
5 notes
¡
View notes
Text
Challenge 60 - Text to Morse
Text-To-Morse-To-Text.cpp
This challenge isn't necessarily "complex", but it is definitely tricky. It is useful to do in the sense that it helps the programmer understand basic file operations (if they have the Morse codes in a file as opposed to an array within the source code) as well as understanding how to process the file.
As usual, I had a lot of fun learning to do this. Morse Code has a certain elegance in its simplicity that isnât really found anywhere.
0 notes
Text
Challenge 40 - Tic Tac Toe
TicTacToe.cpp
From what I can gather, this challenge was included to get the programmer used to making games, by which I mean something with a definitive start and end, all based on user input. Not too difficult to implement, but it was fun programming this nonetheless
0 notes
Text
Challenge 21 - Overlapping Rectangles
Challenge 21: From two 2-D Rectangles, check if they overlap, and if they do, calculate the area
This one was actually kind of tricky, trying to figure out a way to implement the program in a way that would account for all sorts of rectangles... In the end, not too difficult once you realize the minimum information needed to make a rectangle (two points) and knowing that the middle two x and middle two y values make a rectangle on their own (if the two rectangles do happen to intersect)
0 notes
Text
Challenges 2,86,93
Calculates Wind Chill, Converts units of Degrees, and BMI
Honestly, this is one of the easier challenges... The hardest part was finding out the wind chill calculation, and even then, it was pretty self explanatory... I'd say this challenge is decent for an absolute beginner at a language
0 notes
Text
Challenges 17 and 23: Dates
17) Calculate and Print Calendars for Arbitrary Months and Years
23) Calculate the Distance between Two Dates
Header file
Header Implementation
Distance Between Dates and Implements the Date Class
0 notes
Text
Challenge 14 - Quine
âA quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs". â - From Wikipedia (https://en.wikipedia.org/wiki/Quine_(computing))
This was an interesting experiment, I guess...
CODE:
//Quine2.cpp #include int main(int argc, const char * argv[]) { // insert code here... std::string quineArray[1]; quineArray[0] = "//Quine2.cpp #include int main(int argc, const char * argv[]) { std::string quineArray[1] quineArray[0] = ""; for(int i = 0; i < quineArray[0].length; i++) {std::cout << quineArray[0][i];}return 0;"; for(int i = 0; i < quineArray[0].size(); i++) { std::cout << quineArray[0][i]; } return 0; } </div>
1 note
¡
View note
Text
20 - FizzBuzz
Definitely one of the easier challenges, "FizzBuzz" is one of the most well known programming 'challenges' there is. If a number's divisible by 3, print "fizz" and if it's divisible by five, print 'buzz'. Else, print the number... Not really much more to say about this than "That took more time to describe than to actually program," but hey, it's one of the challenges, so here we are.
If you're on your dashboard, open this link... Trust me, it's a lot easier on the eyes:
FizzBuzz.cpp
// Â FizzBuzz on 7/6/16. #include <iostream>
int main(int argc, const char * argv[]) { Â Â for(int i = 0; i < 100; i++) Â Â { Â Â Â std::cout << i << ": "; Â Â Â if(i != 0) Â Â Â { Â Â Â Â Â if(i %3 == 0) Â Â Â Â Â Â Â std::cout << "Fizz"; Â Â Â Â Â if(i%5 == 0) Â Â Â Â Â Â Â std::cout << "Buzz"; Â Â Â Â Â if(i%3 != 0 && i%5 != 0) Â Â Â Â Â Â Â std::cout << i << " "; Â Â Â } Â Â Â Â std::cout<<std::endl; Â Â } Â Â return 0; }
Side Note: Currently trying to figure out a theme that would allow me to put my code with proper programmin syntax. If you have a suggestion, I'd love to hear it out, but worst comes to worst, I can always do the CSS myself
0 notes