We will spend most of the time getting to know those aspects of C++ that are not in Java or are different from Java. These are things like pointers, arrays, classes, templates and inheritance.
The C++ textbook is specially designed for selfstudy and assumes that the reader hasn't programmed before. Thus we will go very quickly over the first 7 chapters (the first "week"), since you are all expected to have programmed before, even though it was in another programming language.
The book comes with two CDs, one with Visual C++, the other with various material connected to the book. Among that material are exercises that you can use to test your knowledge of each chapter. You should use this to ensure that you have understood the material of each chapter. It is very important that you get a good start in C++, as the rest of the class is heavily based on C++.
The sections on january 11.-12. will be in the computer labs as follows:
Those students that are in the CS student computer lab (i.e. group 2 of Tölvunarfræði 2) have to get access to that lab. You have to submit a registration to get that access.
In these first sections we will go through the Visual C++ environment and you will start by going through simple instructions (only in Icelandic!) on the use of Visual C++. Then you should get the file or 4elist0510.cpp, which contains program 5.10 from the textbook, compile it, and run. You are to make a new "Win32 Console Application" and add the program file in by going to "Project | Add to project | Files...". You should try to run the program line by line, by setting up the "Debug toolbar" (right click on toolbar and select Debug). All the programs in the book are online and on CD 1, that comes with the textbook.
int main() { int i; for(i=0; i<10; i++) if( i = 0 ) cout << "Núll" << endl; else cout << "Ekki núll" << endl; return 0; }
#include <iostream> using namespace std; void vixla( int x, int y ) { int t = x; x = y; y = t; } int main() { int i, j; i = 5; j = 8; vixla(i, j); cout << "i=" << i << ", j=" << j << endl; return 0; }