tdde18 726g77
play

TDDE18 & 726G77 Programming in C++ Administration Examiner - PowerPoint PPT Presentation

TDDE18 & 726G77 Programming in C++ Administration Examiner Eric Elfving Course leader Sam Le Assistant 1 Eric Petersson Assistant 2 Alexander Johansson Assistant 3 Mathias Berggren Assistant 4


  1. TDDE18 & 726G77 Programming in C++

  2. Administration • Examiner – Eric Elfving • Course leader – Sam Le • Assistant 1 – Eric Petersson • Assistant 2 – Alexander Johansson • Assistant 3 – Mathias Berggren • Assistant 4 – Kerstin Söderqvist

  3. Course layout • Lectures • Lessons • Labs • 7 labs + introductory lab 0 • Steep increase in difficulty from lab 2 • Exam

  4. Course website All information you need to complete the course exists on the course website

  5. Visual Studio Code • IntelliSense • Debugging • Built-in Git • Extensions https://code.visualstudio.com/

  6. Git • Used for lab submission and lab collaboration between you and your lab partner • Try git

  7. Lab submissions with command line

  8. Lab submission with Visual Studio Code

  9. Sendlab • ~TDDE18/sendlab registration – registrating for lab work • ~TDDE18/sendlab start – starting a lab

  10. Course goal • Explain and compare C++ language features and be able to apply them to relevant problems. • Use the programming environment and tools provided by a standard Linux/UNIX system. • Explain the function of existing C++ implementations and examples. • Write readable, well structured solutions to small programming problems.

  11. main is the start button int main() { }

  12. Input and output Program

  13. Output buffer Program

  14. Cout int main() { std::cout << “Hello world”; …

  15. Output buffer Hello world std::cout << “Hello world”; … Program

  16. Flush buffer • When the program exits • Use something to flush • endl • flush

  17. Flush buffer Hello world std::cout << “Hello world” << std::endl; … Program

  18. Flush buffer ? ? std::cout << “Hello world”; std::cout << “!!!” << std::endl; Program

  19. Variables Value Type Example: • int x{3} • double y{3.14} • char z{‘s’}

  20. Input buffer 3 Program

  21. Cin int main() { int x{}; cin >> x; …

  22. Input buffer int x{0}; std::cin >> x; … 3 Program

  23. Input buffer int x{0}; std::cin >> x; std::cin >> x; 34 99 Program

  24. String Value Type string s{“hello”} s.size() s.front()

  25. Input buffer std ::string s{“temp”}; std::cin >> s; … Hello World Program

  26. Getline std ::string s{“temp”}; std::getline(std::cin, s); … Hello World Program

  27. Includes • iostream #include <iostream> • cin int main() { • cout std::cout >> “Hello world” >> std::endl; } • iomanip • setw • setfill

  28. Namespace #include <iostream> using namespace std; int main() { cout >> “Hello world” >> endl; }

  29. example int main() { int x{}; int y{}; int z{}; cout << z; }

  30. example int main() { string s{}; cout << s; }

  31. example int main() { int x{}; cout << setw(5) << setfill (‘0’) << x << endl; }

  32. example int main() { string s{}; getline(cin, s); cout << s.front () << “ “ << s.back() << endl; } Hello World!!?

  33. Compile g++ file1 [file2…] [flags] g++ file1 g++ file1 file2 g++ file1 – Wall g++ file1 – Wextra – Wall – Wpedantic

  34. Lab 0 • Wednesday at 8.15 • All groups • Help will be available to setup sendlab

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend