C++_programs - C+ Program Structure (and tools) Today we'll...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 332: C++ program structure and development environment C++ Program Structure (and tools) Today we’ll talk generally about C++ development (plus a few platform specifics) We’ll develop, submit, and grade code in Windows It’s also helpful to become familiar with Linux (grid.cec) For example, running code through two different compilers can catch a lot more “easy to make” errors Reference material for today Prata pp. 19-64 Deitel pp. 13-24, 40-59 (correction)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 332: C++ program structure and development environment Writing a C++ Program C++ source files (ASCII text) .cpp Programmer (you) emacs editor C++ header files (ASCII text) .h 1 source file = 1 compilation unit Makefile (ASCII text) Also: .C .cxx .cc Also: .H .hxx .hpp readme (ASCII text) Eclipse Visual Studio
Background image of page 2
CSE 332: C++ program structure and development environment What Goes Into a C++ Program? Declarations: data types, function signatures, classes Allows the compiler to check for type safety, correct syntax Usually kept in “header” (.h) files Included as needed by other files (to keep compiler happy) class Simple { typedef unsigned int UINT32; public: Simple (int i); int usage (char * program_name); void print_i (); private: struct Point2D { int i_; double x_; }; double y_; }; Definitions: static variable initialization, function implementation The part that turns into an executable program Usually kept in “source” (.cc) files void Simple::print_i () { cout << “i_ is ” << i_ << endl; } Directives: tell compiler (or precompiler) to do something More on this later
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 332: C++ program structure and development environment A Very Simple C++ Program #include <iostream> // precompiler directive using namespace std; // compiler directive // definition of function named “main” int main (int, char *[]) { cout << “hello, world!” << endl; return 0; }
Background image of page 4
CSE 332: C++ program structure and development environment
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/03/2010 for the course CSE 332S taught by Professor Smart during the Spring '08 term at Washington University in St. Louis.

Page1 / 15

C++_programs - C+ Program Structure (and tools) Today we'll...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online