cs31 lecture 17

H hpp hh include myfilehpp x be careful about where

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: include “foo.hpp” from “bar.hpp”, which itself starts by which including “bar.hpp” 28 Some syntax example x Include a system-provided header, called iostream: #include <iostream> x Include your own header file (extension: .h, .hpp, .hh)
 #include “myfile.hpp” x Be careful about where the file is located: the compiler Be must know where to find the header must The compiler knows the system include directories, but not your The development directory! development 29 Console output std::cout << “Hello World!” << std::endl; std::cout xThis is read “push to cout the string Hello World, and then This push a newline” push xSyntax std::cout is used to refer to the default console output “foo bar” is a (constant)
 string << is a binary operator, roughly meaning “push <rhs> in <lhs>” std::endl is used to refer to a newline symbol (\n)
 30 A few examples std::cout << “foo”; std::cout << std::endl; // equivalent to std::cout << “foo” << std::endl; std::cout << “Hello” << “ “ << “Worl...
View Full Document

Ask a homework question - tutors are online