IMPORTANT NOTE: the projects in this repo were done in my second semester of intro to computer science class. I had only ~4 months of real programming experience
Object-oriented algorithmic problem solving in C++, with attention to general as well as language-specific issues including pointer and pointer arithmetic; linked lists; memory management; recursion; operator overloading; inheritance and polymorphism; stream and file I/O; exception handling; templates and STL; applications of simple data structures; testing and debugging techniques.
Write a program to find and print the first perfect square (i*i) whose last two digits are both odd.
Make sure to check that the answer you get is indeed a perfect square.
a[] = {1,2,3,4,5} b[] = {3,4,5,1,2}
It is possible to transform array a into array b by right shifting each element of a to the “right” three places. If an element “falls off” the back of the array have it come around the front and keep counting positions. That is how 3 in array ended up in the first position of array b. One way to look at this is to imagine that we are moving the element around in a circular manner. In the example above, we have right shifted the array 3 positions to the right. Definition: Let a and b be two integer arrays of the same length. We say that they are “shift equivalent” if array a can be right shifted to create array b.
PROBLEM:
Write a function bool equivalent(int a[], int b[], int n) which takes two arrays a and b of length n and returns true is they are shift equivalent and false otherwise.
Redo the 2D 8 queens problems using a 1D array instead of a 2D array.
Inside a loop we sum up the area of rectangles with a small base (say .0001) and height f(x) for each x between a and b in increments of .0001. a = 1 b=5. Find the integral when f(x) = x, f(x) = x^2 and f(x) = x^3 between 1 and 5.
When the loop terminates, we return the value of the sum.