1 / 25

C++ for beginners Lecture 0

C++ for beginners Lecture 0. © 2008 Richèl Bilderbeek. Question. Which kind of programs can be written in C++?. Answer. Every kind of program. Question. Which programming style does C++ enforce?. Answer. None. About C++. Developed by Bjarne Stroustrup in 1983 ‘A better C’

telma
Download Presentation

C++ for beginners Lecture 0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. C++ for beginnersLecture 0 © 2008 Richèl Bilderbeek

  2. Question • Which kind of programs can be written in C++?

  3. Answer • Every kind of program

  4. Question • Which programming style does C++ enforce?

  5. Answer • None

  6. About C++ • Developed by Bjarne Stroustrup in 1983 • ‘A better C’ • (largely) backwards-compatible with C • Emphasis on speed • Platform independent, but without standard graphics support • Many users (but declining in favor of C# and Java)

  7. About C++ • Multi paradigm language • You are allowed to do everything you want • You want to overload the plus operator to subtract? That's fine • You don't want to program in a const-correct way? That's fine • You don't want to use templates? That's fine • You don't want to use classes? That's fine

  8. Question • In which ways should your Integrated Development Environment (IDE) (your 'programming program') help you?

  9. Answer • Depends on your needs • But a beginner can use all the help he/she can get!

  10. C++ Builder 6 • Borland (now CodeGear) IDE • Helpful while programming • Function and class browsing • Helpful while debugging • Breakpoints, step through code, call stack • VCL library for Graphical User Interface (GUI) ('Windows') applications

  11. Question • Which book is the best book to use for a beginners training?

  12. Answer • Depends on the trainee • Dutch or English? • Easy read or correct?

  13. The book • Ammeraal. C++. 6e editie, 2001. • Fine Dutch reference • Partly outdated*, due to this sometimes unusual or 'evil' style *The most important books came out later...

  14. Question • What should be in a training manual?

  15. Answer • Summary of the treated theory, especially the theory that cannot be found in the book • Correction of the book • Advice • Additional exercises • All is in the manual

  16. This training • Day 1: Basics • Day 2: Functions • Day 3: std::vector • Day 4: Classes • Day 5: Polymorphism and inheritance

  17. A day of training • 9:00 startup up with coffee • 9:30-10:30: lecture • 10:30-10:45: break • 10:45-12:30: to work • 12:30-13:15: luch • 13:15-14:45: to work • 14:45-15:00: break • 15:00-16:30: to work

  18. Question • Which steps are between code and executable?

  19. Answer • Compiling • Convert code of each unit to object code • Many checks of your code • Linking • Connects unit object code to single executable

  20. Your compiler is your friend • The compiler does many checks on your code • The compiler knows how you should write valid C++ • The compiler will give you advice in the form of warnings and 'errors' • Always compile cleanly

  21. 'Hello world' program #include <iostream> //Header file int main() { std::cout //Write to screen << “Hello world” //this text << std::endl; //end line std::cin.get(); //wait for key }

  22. Question • Can you get a 'Hello World' program to run in C++ Builder 6? • What to do if you don't succeed? • If you make errors (on purpose), what does the compiler tell you? • Can you save and load it? • Try!

  23. Hint • Always first do 'File | Close All'

  24. Hint • Start a Console Application by • 'File | New | Other' • Select 'Console Wizard' • Set 'Source' to C++ • Only leave 'Console Application' checked

  25. Hint • C++ Builder will create a Project and a Unit for you. Let the filename for the Project start with 'Project', let the filename for the Unit start with 'Unit'. If they are the same you loose either your project (ok) or your code (very bad)

More Related