First week of programming
|
After almost five years I now return to programing. Prior to beginning this course I have had some experience in using Java but not at any advanced level. Having written code before helped me to understand all the lectures so far, but I have a feeling that with the speed we move on to new things I’ll be lost next week. Being the first week I don’t really have any interesting code to talk about. The most fun exercise was to create the “bottles of X on the wall” program. I found a website (http://www.99-bottles-of-beer.net/) where user could submit a solution in different languages where some tried to create the most advanced version and some the most compact version. My code is more primitive than those: #include int main(int argc, char*arhv[]){ int bottles; std::cout << ”Decide the number of bottles!”; while (bottles > 0){ } std::cin.ignore(1024, ‘n’); } If I look on this code later I could probably find a better way to do this. In my first version I used int userInput; with bottles = userInput resulting in some very unnecessary extra code. |