I'm interested in learning to code, specifically C++ as a most obvious way. I get the essentials of this, read a few books and articles online. I've minorly coded before; but nothing much or helpful. Would anyone mind giving me some good sources to begin actually jumpstarting my way into C++ coding and perhaps some minor Algorithims? I plan on going to College for Computer Science Engineering (or something akin to such) and I'd first of all like to get a headstart on the competition, and get a new hobby that interests me. So please, if anyone can know ^_^
Invent your own algorithms. That's what programming is. Try these. Report when you've done them: 1. print your name on screen. 2. input two numbers A and B. Multiply them together and print the result as text in a formatted string such as "3 multiplied by 5 equals 15" 3. Input a number A. Calculate the sum of all whole numbers from 1 to A inclusive. Print the result on screen. 4. input a number X. Test if X is divisible by 7, and print the result on screen as text, such as "210 is divisible by 7." 5. Input a number X. Test if X is prime by seeing if it is divisible by all numbers from 2 upto X-1. Report the result as text in a formatted string such as "31 is prime." 6. Extend program 5. Instead of X, now input a number Y. Automatically test all numbers from 2 upwards until you find the Y'th prime number. Print the Y'th prime number. 7. Create an array called Primes[ ] . Populate it with the primes, such that the Y'th entry is the Y'th prime number, upto Y=1000. Create another array called Products[ ], of long integers. Consider all pairs A and B, such that A is not equal to B, no less than 1 and no greater than 1000. Multiply the A'th prime with the B'th prime and insert the result into the next vacant slot in Products array. You will need to create a counter which steps forward through the Products array. Finally, add up all the entries in the products array and print the answer. 8. Run through the products array comparing adjacent pairs, and if the lower number us bigger than the upper number, then swap them. Keep running through the array until you can no longer swap any more. The numbers will have been sorted from smallest to biggest. This is called a Bubble-Sort. So now print out the smallest 100 elements in the array.
Don't forgot to include loops and decision statements in those as well. heres a site for C++ for a college course no password or user name required. http://www.cs.niu.edu/~abyrnes/csci240/ Also heres a free compiler http://www.bloodshed.net/devcpp.html And heres a basic set of source code to get ya started: //Begin code #include <iostream> #include <iomanip> using namespace std; int main() { //Your code here system("pause"); return 0; } //end code
Jasmine's exercises look a lot like what might be assigned in the first month of an intro programming class. Definitely relevant practice.
I personally know nothing, but here's two good links (1st better than second). Link 1 Link 2 The first one is a list of lessons and such by an awesome guy. The second is less organized, but is posted by someone much like you. There's some good links in that thread.
The ironic thing is that Im pretty good at C++ programming, but I don't like doing it.. especially when the output has to be formated EXACTLY in a specific way. Blah...