inleiding tot programmeren - practicum 2

15
Inleiding tot Programmeren Practicum 2 Ruben Van den Bossche [email protected]

Upload: rvdbossc

Post on 29-Nov-2014

571 views

Category:

Technology


5 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Inleiding tot Programmeren - Practicum 2

Inleiding tot ProgrammerenPracticum 2Ruben Van den [email protected]

Page 2: Inleiding tot Programmeren - Practicum 2

Practicum 2

• Projecten importeren en exporteren• Voorbeeldcode: gobelijn• Types• if-statement• for-lus• while-lus

2

Page 3: Inleiding tot Programmeren - Practicum 2

Project exporteren

• Klik File > Export• Kies General > Archive file• Selecteer de projecten die je wil exporteren

• Geef het archief een naam en locatie- Klik Browse...- Kies naam en locatie

• Klik Finish

3

Page 4: Inleiding tot Programmeren - Practicum 2

Project importeren

• Klik File > Import• Kies General > Existing projects into workspace• Kies Select archive file• Klik Browse naast Select archive file• Selecteer het Eclipse-archief• Klik Finish

4

Page 5: Inleiding tot Programmeren - Practicum 2

Opslagmogelijkheden

• Mail• Fileserver UA

- Places > Connect to Server

• Dropbox- Gratis en veelgebruikt- Registreren via http://db.tt/Uy2utDw

5

Page 6: Inleiding tot Programmeren - Practicum 2

Practicum 2

• Projecten importeren en exporteren• Voorbeeldcode: gobelijn• Types• if-statement• for-lus• while-lus

6

Page 7: Inleiding tot Programmeren - Practicum 2

Voorbeeldcode: Gobelijn

• Op computers in computerklas• In Virtuele Machine

• Build via “Make targets”- bootstrap- build_all- remove_build

7

Page 8: Inleiding tot Programmeren - Practicum 2

Practicum 2

• Projecten importeren en exporteren• Voorbeeldcode: gobelijn• Types• if-statement• for-lus• while-lus

8

Page 9: Inleiding tot Programmeren - Practicum 2

Types• int• double• char• bool

• string- speciaal geval- schrijf #include <string>bovenaan je programma!

9

Page 10: Inleiding tot Programmeren - Practicum 2

Practicum 2

• Projecten importeren en exporteren• Voorbeeldcode: gobelijn• Types• if-statement• for-lus• while-lus

10

Page 11: Inleiding tot Programmeren - Practicum 2

if-statement• Relatie-operatoren

==, !=, <, >, <=, >=• && betekent and, || betekent or, ! betekent not

11

// example of an if-statementif ((x <= 5) && (y != 7)){

z = 12;}else if (x > 5){

z = 13;}else{

z = 14;}

Page 12: Inleiding tot Programmeren - Practicum 2

Practicum 2

• Projecten importeren en exporteren• Voorbeeldcode: gobelijn• Types• if-statement• for-lus• while-lus

12

Page 13: Inleiding tot Programmeren - Practicum 2

for-lus• for-header bevat 3 delen:

- int i = 0: Initiële expressie, wordt uitgevoerd bij aanvang van de lus

- i < 10: Als conditional == true wordt body uitgevoerd. Conditional wordt gecontroleerd voor elke iteratie.

- i++: Finale expressie, wordt uitgevoerd aan het einde van elke iteratie.

13

// example of a for-loop from 0 to 9for(int i = 0; i < 10; i++){cout << i;

}

Page 14: Inleiding tot Programmeren - Practicum 2

Practicum 2

• Projecten importeren en exporteren• Voorbeeldcode: gobelijn• Types• if-statement• for-lus• while-lus

14

Page 15: Inleiding tot Programmeren - Practicum 2

while-lus

15

// example of a while-loopwhile (x < 5){y = z + x;x += 1;

}

• while-lus wordt uitgevoerd zolang conditie waar is.