80 likes | 181 Views
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 QT adds GUIs to C++ QT adds multi-platform IO to C++. C++ is like C. Comments are the same // or /* */
E N D
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++
C++ is like C • Comments are the same • // or /* */ • Still need to include header files • #include
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.
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!
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
Compiling C++ • g++ file.cpp • produces 'a.out' or 'a.exe' • Makefiles can also be used (common)