{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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; }
Image of page 4
CSE 332: C++ program structure and development environment What is #include <iostream> ?
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern