c++ coding and compiling. why qt/c++ over java? java is easier than c++ java has built in guis ...

8
C++ Coding and Compiling

Upload: baldric-may

Post on 04-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

C++ Coding and Compiling

Page 2: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

Why QT/C++ Over Java? Java is easier than C++ Java has built in GUIs Java is multi-platform C/C++ is more used in industry QT adds GUIs to C++ QT adds multi-platform IO to C++

Page 3: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

C++ is like C Comments are the same

// or /* */ Still need to include header files

#include

Page 4: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

C++ is a little different Declaring variables have 3 flavors

type-expr variableName; type-expr variableName = value; type-expr variableName (value);

Namespaces Like a group of header files. By listing the

namespace, you include all of the files.

Page 5: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

Inputs and Outputs cin -Standard Input (Keyboard) cout -Standard Output (Text) cerr -Standard Error Output (Text) These are all examples of 'streams'

Streams are a key way that C++ thinks of inputs and outputs. They are also Objects!

Page 6: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

What is an Object? An object is like a structure An object has things that can be done

only to that object An object has attributes that apply only

to it Example: A car is an object

Page 7: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

Lets look at some code

Page 8: C++ Coding and Compiling. Why QT/C++ Over Java?  Java is easier than C++  Java has built in GUIs  Java is multi-platform  C/C++ is more used in industry

Compiling C++ g++ file.cpp

produces 'a.out' or 'a.exe' Makefiles can also be used (common)