ECE
ECE 1574 Week 1 Program Structure.docx

ECE 1574 Week 1 Program Structure.docx - Structure of a C...

Info icon This preview shows pages 1–2. Sign up to view the full content.

Structure of a C++ program /* Comments may be used to describe the program’s purpose. This method comments the entire line. */ // This is another way to mark a comment. This method can be used following executable code. #include<iostream> #include<cmath> using namespace std; int main() { // Declare and initialize variables double x1, x2, y1, y2, s1, s2, dist; char pause; Preprocessor directives – tell the compiler to include the contents of these files when it compiles the program. File names that are part of the standard C++ library are enclosed in pointy brackets < >. Any nonstandard or custom files to be invoked by the compiler would have the filename enclosed with quotation marks, like this: #include “Point.h” // note that most header files have an “h” extension. The using directive tells the compiler to use the library filenames declared in the namespace std . A namespace is where C++ declares all its entities so the compiler can interpret the statements in the user’s program.
Image of page 1

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

Image of page 2
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